From b468e1ad0a99abc80a4972ddfcf81a2dc0750802 Mon Sep 17 00:00:00 2001
From: Steve Nyemba
Date: Fri, 9 Aug 2024 15:02:43 -0500
Subject: [PATCH] bug fixes
---
cms/disk.py | 4 +++-
cms/engine/project/__init__.py | 3 ++-
cms/index.py | 30 ++++++++++++++++++++++++------
cms/templates/index.html | 2 +-
4 files changed, 30 insertions(+), 9 deletions(-)
diff --git a/cms/disk.py b/cms/disk.py
index 8a3b8f6..3d31f76 100644
--- a/cms/disk.py
+++ b/cms/disk.py
@@ -5,6 +5,7 @@ import os
import importlib
import importlib.util
import copy
+import mistune
from mistune import markdown
import re
@@ -122,7 +123,8 @@ def html(_uri,_config) :
_api = os.sep.join([f'{_context}/api/disk/read?uri=',_layout['root']])
if f"{_layout['root']}{os.sep}" in _html :
_html = _html.replace(f"{_layout['root']}",_api)
- _html = markdown(_html).replace(""",'"').replace("<","<").replace(">",">") if _uri[-2:] in ['md','MD','Md','mD'] else _html
+ _html = mistune.html(_html).replace(""",'"').replace("<","<").replace(">",">") if _uri[-2:] in ['md','MD','Md','mD'] else _html
+
return _html
def plugins (**_args):
diff --git a/cms/engine/project/__init__.py b/cms/engine/project/__init__.py
index a24339f..7b1e6ef 100644
--- a/cms/engine/project/__init__.py
+++ b/cms/engine/project/__init__.py
@@ -118,7 +118,7 @@ def _index (_path,root):
"""
_indexfile = os.sep.join([_path,'index.html'])
- if os.path.exists(_indexfile):
+ if not os.path.exists(_indexfile) and os.path.exists(_path):
#
# In case a project needs to be upgraded ...
f = open(_indexfile,'w')
@@ -149,6 +149,7 @@ def make (**_args) :
f.close()
_ilogo(os.sep.join([_folder,_root]))
+ print ([_folder,_root])
_index(os.sep.join([_folder,_root]),_root)
_itheme(_folder,_root)
\ No newline at end of file
diff --git a/cms/index.py b/cms/index.py
index 7e002b6..5fbe446 100644
--- a/cms/index.py
+++ b/cms/index.py
@@ -177,23 +177,41 @@ def _version ():
_handler = _route.get()
global _config
return _handler.system()['version']
-@_app.route('/reload',methods=['POST'])
-def reload():
+@_app.route("/reload/")
+def _reload(key) :
global _route
_handler = _route.get_main()
_system = _handler.system()
- _key = request.headers['key'] if 'key' in request.headers else None
if not 'source' in _system :
_systemKey = None
elif 'key' in _system['source'] and _system['source']['key']:
_systemKey = _system['source']['key']
- print ([_key,_systemKey,_systemKey == _key])
- if _key and _systemKey and _systemKey == _key :
+ print ([key,_systemKey,_systemKey == key])
+ if key and _systemKey and _systemKey == key :
_handler.reload()
return "",200
pass
- return "",403
+ return "",403
+
+@_app.route('/reload',methods=['POST'])
+def reload():
+ # global _route
+
+ # _handler = _route.get_main()
+ # _system = _handler.system()
+ _key = request.headers['key'] if 'key' in request.headers else None
+ return _reload(_key)
+ # if not 'source' in _system :
+ # _systemKey = None
+ # elif 'key' in _system['source'] and _system['source']['key']:
+ # _systemKey = _system['source']['key']
+ # print ([_key,_systemKey,_systemKey == _key])
+ # if _key and _systemKey and _systemKey == _key :
+ # _handler.reload()
+ # return "",200
+ # pass
+ # return "",403
@_app.route('/page',methods=['POST'])
def cms_page():
"""
diff --git a/cms/templates/index.html b/cms/templates/index.html
index a99be3d..dc9a2eb 100644
--- a/cms/templates/index.html
+++ b/cms/templates/index.html
@@ -69,7 +69,7 @@ Vanderbilt University Medical Center
-