bug fixes (usability)

v2.0
Steve Nyemba 5 months ago
parent 6ed700a51e
commit 8b119a7133

@ -315,6 +315,8 @@ def create(folder:Annotated[str,typer.Argument(help="path of the project folder"
f.close() f.close()
print (f'{PASSED} configuration being written to project folder') print (f'{PASSED} configuration being written to project folder')
_args = {'title':title,'subtitle':subtitle,'version':version,'root':root,'index':index} _args = {'title':title,'subtitle':subtitle,'version':version,'root':root,'index':index}
if footer :
_args['footer'] = footer
_config = make(**_args) _config = make(**_args)
# #
# updating logo reference (default for now) # updating logo reference (default for now)
@ -331,11 +333,18 @@ def reload (path) :
if os.path.exists (path): if os.path.exists (path):
pass pass
@cli.command(name="bootup") @cli.command(name="bootup")
def bootup (path:Annotated[str,typer.Argument(help="path of the manifest file")]='qcms-manifest.json'): def bootup (
path:Annotated[str,typer.Argument(help="path of the manifest file")]='qcms-manifest.json',
port:int=typer.Option(default=None, help="port number to serve on (will override configuration)")
):
""" """
This function will launch a site/project given the location of the manifest file This function will launch a site/project given the location of the manifest file
""" """
index.start(path) index.start(path,port)
# if not port :
# index.start(path)
# else:
# index.start(path,port)
def reset(): def reset():
""" """

@ -6,7 +6,10 @@ from cms import disk, cloud
from jinja2 import Environment, BaseLoader, FileSystemLoader from jinja2 import Environment, BaseLoader, FileSystemLoader
import importlib import importlib
import importlib.util import importlib.util
"""
There are four classes at play here:
[ Initializer ] <|-- [ Module ] <|-- [ MicroService ] <--<>[ CMS ]
"""
class Initializer : class Initializer :
""" """
@ -25,19 +28,12 @@ class Initializer :
# print ([self._ISCLOUD,self._config['system'].keys()]) # print ([self._ISCLOUD,self._config['system'].keys()])
self._ISCLOUD = False self._ISCLOUD = False
self._caller = None if 'caller' not in _args else _args['caller'] self._caller = None if 'caller' not in _args else _args['caller']
#
# actual initialization of the CMS components
# self._iconfig(**_args)
# self._uconfig(**_args)
# self._isource()
# self._imenu()
# self._iplugins()
self._args = _args self._args = _args
self.reload()
self.reload() #-- this is an initial load of various components
def reload(self): def reload(self):
self._iconfig(**self._args) self._iconfig(**self._args)
self._uconfig(**self._args) self._uconfig(**self._args)
self._isource() self._isource()
@ -292,9 +288,9 @@ class Initializer :
# self.set('layout.root',os.sep.join([_path,_oroot])) # self.set('layout.root',os.sep.join([_path,_oroot]))
pass pass
class Accessor (Initializer): class Module (Initializer):
""" """
This is a basic structure for an application working in either portal or app mode This is a basic structure for an application working in either portal or app mode,
""" """
def __init__(self,**_args): def __init__(self,**_args):
super().__init__(**_args) super().__init__(**_args)
@ -362,9 +358,9 @@ class Accessor (Initializer):
# #
return _found return _found
# #
class MicroService (Accessor): class MicroService (Module):
""" """
This is a CMS MicroService class that is capable of initializing a site and exposing accessor functions This is a CMS MicroService class that is capable of initializing a site and exposing Module functions
""" """
def __init__(self,**_args): def __init__(self,**_args):
super().__init__(**_args) super().__init__(**_args)
@ -389,6 +385,9 @@ class MicroService (Accessor):
return _handler.read(uri=_uri,config=self._config) return _handler.read(uri=_uri,config=self._config)
class CMS: class CMS:
"""
This class aggregates microservices and allows the application of a given service (site/app)
"""
def __init__(self,**_args) : def __init__(self,**_args) :
# _app = Getter (path = path) # _app = Getter (path = path)

@ -285,7 +285,10 @@ def _open(id):
@cli.command() @cli.command()
def start ( def start (
path:Annotated[str,typer.Argument(help="path of the manifest file")]='qcms-manifest.json') : path:Annotated[str,typer.Argument(help="path of the manifest file")]='qcms-manifest.json',
port:int=typer.Option(default=None, help="port number to serve on (will override configuration)")
) :
""" """
This function is designed to start the application with its associated manifest (configuration) location This function is designed to start the application with its associated manifest (configuration) location
:path path to the the manifest :path path to the the manifest
@ -307,6 +310,8 @@ def start (
# dir(_route) # dir(_route)
# _args = _route.get().get_app() # _args = _route.get().get_app()
_args = _route.get().app() _args = _route.get().app()
if port :
_args['port'] = port
_app.secret_key = str(uuid.uuid4()) _app.secret_key = str(uuid.uuid4())
_app.config['PERMANENT_SESSION_LIFETIME'] = datetime.timedelta(hours=24) _app.config['PERMANENT_SESSION_LIFETIME'] = datetime.timedelta(hours=24)
_app.run(**_args) _app.run(**_args)

Loading…
Cancel
Save