From 493f532f62c0d8975aac0bd809e231781134fed2 Mon Sep 17 00:00:00 2001 From: Steve Nyemba Date: Wed, 16 Jul 2025 22:12:23 -0500 Subject: [PATCH] bug fix: removing repeats, other bug fixes --- cms/disk.py | 14 ++++++++------ cms/index.py | 3 ++- cms/sites/__init__.py | 2 -- readme.md | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/cms/disk.py b/cms/disk.py index 4d105b4..b4531c8 100644 --- a/cms/disk.py +++ b/cms/disk.py @@ -113,6 +113,7 @@ def exists(**_args): return os.path.exists(_path) def html(_uri,_config) : # _html = (open(uri)).read() + _path = _realpath(_uri,_config) _context = str(_config['system']['context']) # if '/' in _context : @@ -123,15 +124,16 @@ def html(_uri,_config) : _layout = _config['layout'] if 'location' in _layout : 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: - _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 : - _html = _html.replace(f"{_layout['root']}",_api) + _html = _html.replace('/api/disk/read?uri=','').replace(f"{_layout['root']}",_api) _html = mistune.html(_html).replace(""",'"').replace("<","<").replace(">",">") if _uri[-2:] in ['md','MD','Md','mD'] else _html - - + # _html = _html.replace(f'{os.sep}{_layout["root"]}',_layout['root']) + return _html def plugins (**_args): """ @@ -176,4 +178,4 @@ def plugins (**_args): # # # # LOG This plugin .... # return getattr(module,_name) if hasattr(module,_name) else None - \ No newline at end of file + diff --git a/cms/index.py b/cms/index.py index d5234f4..96ce449 100644 --- a/cms/index.py +++ b/cms/index.py @@ -95,7 +95,8 @@ def _index (): _app = _qcms.get(None) _uri = os.sep.join([_app.get('layout.root'),_app.get('layout.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.route("/",defaults={'resource':None}) diff --git a/cms/sites/__init__.py b/cms/sites/__init__.py index 8150f90..8dc2a11 100644 --- a/cms/sites/__init__.py +++ b/cms/sites/__init__.py @@ -316,9 +316,7 @@ class Site(Initialization) : self._config['system']['portal'] = (self.get('system.routes')) == None def html(self,_uri,_id) : _handler = cloud if self.get('system.source.id') == 'cloud' else disk - _html = _handler.html(_uri, self.get(None)) - return " ".join([f'
',_html,"
"]) class QCMS: diff --git a/readme.md b/readme.md index 11855bb..9683f83 100644 --- a/readme.md +++ b/readme.md @@ -18,7 +18,7 @@ QCMS comes with standard web frameworks and python frameworks out of the box **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**