diff --git a/cms/__init__.py b/cms/__init__.py index ba9b00c..2a4b745 100644 --- a/cms/__init__.py +++ b/cms/__init__.py @@ -149,8 +149,9 @@ class components : _conf = _config['plugins'] for _key in _conf : + _path = os.sep.join([PATH,_key+".py"]) - if not os.sep.path.exists(_path): + if not os.path.exists(_path): continue for _name in _conf[_key] : _pointer = components.load_plugin(path=_path,name=_name) diff --git a/cms/cloud.py b/cms/cloud.py index 2dbc792..c2715bc 100644 --- a/cms/cloud.py +++ b/cms/cloud.py @@ -68,6 +68,7 @@ def content(_args): # uri = _item # print ([_menuItem, _menuItem in _menu]) uri = '/'.join(_item.path.split('/')[2:]) + uri = _item.path _menu[_folder].append({'text':_item.name.split('.')[0],'uri':uri}) # # clean up the content ... @@ -99,16 +100,16 @@ def html (uri,_config) : _prefix = '/'.join (uri.split('/')[:-1]) _link = '/'.join(['{{context}}api/cloud/download?doc='+_prefix,'.attachments.']) - print ([_link]) + + # _link = '/'.join(['api/cloud/download?doc='+_prefix,'_images']) + print (uri) _html = _handler.get_file_contents(uri).decode('utf-8')#.replace('.attachments.', copy.deepcopy(_link)) # print ([uri,uri[-2:] ,uri[-2:] in ['md','MD','markdown']]) _handler.logout() # if uri.endswith('.md'): _html = _html.replace(_root,('{{context}}api/cloud/download?doc='+_root)).replace('.attachments.', copy.deepcopy(_link)) - if '.attachments.' in _html : - print (_html) # _html = _html.replace('
','') return markdown(_html) if uri[-2:] in ['md','MD','Md','mD'] else _html # def update (_config): diff --git a/index.py b/index.py index fce5c8a..3c8cd44 100644 --- a/index.py +++ b/index.py @@ -108,7 +108,8 @@ def _getproxy(module,name) : uri = '/'.join(['api',module,name]) _args = dict(request.args,**{}) - _args['config'] = _config + _args['config'] = copy.deepcopy(_config) + if uri not in _config['plugins'] : _data = {} _code = 404 @@ -133,7 +134,7 @@ def _post (module,name): _info = "" if uri in _config['plugins'] and _args: _pointer = _config['plugins'][uri] - _info = _pointer(_args) + _info = _pointer(**_args) if _info: code = 200 else: @@ -142,6 +143,7 @@ def _post (module,name): # _info =io.BytesIO(_info) # _info = base64.encodebytes(_info.getvalue()).decode('ascii') + return _info,code @_app.route('/version') def _version (): @@ -161,6 +163,7 @@ def cms_page(): _system = cms.components.get_system(_config) + print ([_uri]) _html = cms.components.html(_uri,_id,_args,_system) e = Environment(loader=BaseLoader()).from_string(_html) # _data = {} #cms.components.data(_config)