From a347c0b624ee97216f594109e7ed3b363f11993e Mon Sep 17 00:00:00 2001
From: Steve Nyemba <nyemba@gmail.com>
Date: Wed, 12 Feb 2025 22:13:15 -0600
Subject: [PATCH] bug fix: enforcing method specification

---
 bin/qcms        |  2 +-
 cms/__init__.py | 21 +++++++++++----------
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/bin/qcms b/bin/qcms
index c7edab8..bec6c4e 100755
--- a/bin/qcms
+++ b/bin/qcms
@@ -338,7 +338,7 @@ def reload (
         url = f"http://localhost:{_port}/reload"
         resp = requests.post(url, headers={"key":key})
         if resp.status_code == 200 :
-            _msg = f"""{PASSED} [bold]{_config['system']['layout']['header']['title']}[/bold] : successfully reloaded {url}"""
+            _msg = f"""{PASSED} [bold]{_config['layout']['header']['title']}[/bold] : successfully reloaded {url}"""
         else:
             _msg = f"""{FAILED} failed to reload, status code {resp.status_code}\n{url}
             """
diff --git a/cms/__init__.py b/cms/__init__.py
index 53c61c0..d621116 100644
--- a/cms/__init__.py
+++ b/cms/__init__.py
@@ -142,19 +142,20 @@ class delegate:
             
 
             _pointer = _plugins[_uri]
-            if hasattr(_pointer,'mimetype') and _request.method in _pointer.method:
+            _data = {}
+            if hasattr(_pointer,'mimetype') and hasattr(_pointer,'method'):
                 #
                 # we constraint the methods given their execution ...
-                _mimeType = _pointer.mimetype
-                _data = _pointer(request=_request,config=_config)
-            else:
-                _mimeType = 'application/octet-stream'
-                try:
-                    _data,_mimeType = _pointer(request=_request,config=_config)
-                    
-                except Exception as e:
-                    
+                _mimeType = _pointer.mimetype 
+                if  _request.method in _pointer.method :
                     _data = _pointer(request=_request,config=_config)
+            elif not hasattr(_pointer,'mimetype'):
+                
+                _data,_mimeType = _pointer(request=_request,config=_config)
+                    
+            else:     
+                _mimeType = 'application/octet-stream'
+            #     _data = _pointer(request=_request,config=_config)
             if type(_data) == pd.DataFrame :
                 _data = _data.to_json(orient='records')
             elif type(_data) in [dict,list] :