fixes, uri, root

master
Steve Nyemba 10 months ago
parent 769e2f7169
commit 493cdee641

@ -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)

@ -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('<br />','')
return markdown(_html) if uri[-2:] in ['md','MD','Md','mD'] else _html
# def update (_config):

@ -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)

Loading…
Cancel
Save