bug fix: removing repeats, other bug fixes

pull/40/head
Steve Nyemba 2 months ago
parent fc32ceb161
commit 493f532f62

@ -113,6 +113,7 @@ def exists(**_args):
return os.path.exists(_path) return os.path.exists(_path)
def html(_uri,_config) : def html(_uri,_config) :
# _html = (open(uri)).read() # _html = (open(uri)).read()
_path = _realpath(_uri,_config) _path = _realpath(_uri,_config)
_context = str(_config['system']['context']) _context = str(_config['system']['context'])
# if '/' in _context : # if '/' in _context :
@ -123,15 +124,16 @@ def html(_uri,_config) :
_layout = _config['layout'] _layout = _config['layout']
if 'location' in _layout : if 'location' in _layout :
if not _config : if not _config :
_api = os.sep.join(['api/disk/read?uri=',_layout['root']]) _api = os.sep.join(['api/disk/read?uri=',copy.copy(_layout['root']) ])
else: else:
_api = os.sep.join([f'{_context}/api/disk/read?uri=',_layout['root']]) _api = os.sep.join([f'{_context}/api/disk/read?uri=',copy.copy(_layout['root'])])
if f"{_layout['root']}{os.sep}" in _html : if f"{_layout['root']}{os.sep}" in _html :
_html = _html.replace(f"{_layout['root']}",_api) _html = _html.replace('/api/disk/read?uri=','').replace(f"{_layout['root']}",_api)
_html = mistune.html(_html).replace("&quot;",'"').replace("&lt;","<").replace("&gt;",">") if _uri[-2:] in ['md','MD','Md','mD'] else _html _html = mistune.html(_html).replace("&quot;",'"').replace("&lt;","<").replace("&gt;",">") if _uri[-2:] in ['md','MD','Md','mD'] else _html
# _html = _html.replace(f'{os.sep}{_layout["root"]}',_layout['root'])
return _html return _html
def plugins (**_args): def plugins (**_args):
""" """
@ -176,4 +178,4 @@ def plugins (**_args):
# # # #
# # LOG This plugin .... # # LOG This plugin ....
# return getattr(module,_name) if hasattr(module,_name) else None # return getattr(module,_name) if hasattr(module,_name) else None

@ -95,7 +95,8 @@ def _index ():
_app = _qcms.get(None) _app = _qcms.get(None)
_uri = os.sep.join([_app.get('layout.root'),_app.get('layout.index')]) _uri = os.sep.join([_app.get('layout.root'),_app.get('layout.index')])
_html = _qcms.render(_uri,'index') _html = _qcms.render(_uri,'index')
return render_template('index.html',**_qcms.render(_uri,'index')),200 print (_html)
return render_template('index.html',**_html),200 #render_template('index.html',**_qcms.render(_uri,'index')),200
@_app.route("/<app>/<resource>") @_app.route("/<app>/<resource>")
@_app.route("/<app>",defaults={'resource':None}) @_app.route("/<app>",defaults={'resource':None})

@ -316,9 +316,7 @@ class Site(Initialization) :
self._config['system']['portal'] = (self.get('system.routes')) == None self._config['system']['portal'] = (self.get('system.routes')) == None
def html(self,_uri,_id) : def html(self,_uri,_id) :
_handler = cloud if self.get('system.source.id') == 'cloud' else disk _handler = cloud if self.get('system.source.id') == 'cloud' else disk
_html = _handler.html(_uri, self.get(None)) _html = _handler.html(_uri, self.get(None))
return " ".join([f'<div id="{_id}"> ',_html,"</div>"]) return " ".join([f'<div id="{_id}"> ',_html,"</div>"])
class QCMS: class QCMS:

@ -18,7 +18,7 @@ QCMS comes with standard web frameworks and python frameworks out of the box
**1. Installation** **1. Installation**
pip install dev.the-phi.com/git/qcms/cms pip install qcms@git+https://dev.the-phi.com/git/qcms/cms
**2. Create your project** **2. Create your project**

Loading…
Cancel
Save