encadre

Encadre, petit framework web Python (Flask) : contrôleurs en greffons, validation, tests
git clone https://git.schurger.org/encadre.git
Log | Files | Refs

commit 1783a7a4a601dc83a0218d45e376383b034132b7
parent e6da3cfd64654b1344f1f4d8a0a083cb63746214
Author: Jean Schurger <jean@schurger.org>
Date:   Fri,  7 Mar 2025 14:08:42 +0100

Expose framework.

Diffstat:
Mencadre/__init__.py | 20+++++++++-----------
Msetup.py | 2+-
2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/encadre/__init__.py b/encadre/__init__.py @@ -45,6 +45,10 @@ class Encadre(): print("You'd better configure logging in '%s':\n%s" % (self.config_filename, traceback.format_exc())) setattr(sys.modules['encadre'], 'config', self.config) + self.framework = framework_from_config(self.__class__.__name__.lower(), + self.config) + self.framework.setup_application(self) + load_controllers(self.framework, self.application) def read_config(self, filename): config = {self.__class__.__name__.lower(): {}} @@ -57,24 +61,18 @@ class Encadre(): def serve(self): assert self.config, "Missing config." - f = framework_from_config(self.__class__.__name__.lower(), self.config) - f.setup_application(self) - load_controllers(f, self.application) - f.serve() + self.framework.serve() def dump_routes(self): assert self.config, "Missing config." - f = DumpRoutes(self.__class__.__name__.lower(), self.config) - load_controllers(f, self.application) - print(f) + routes = DumpRoutes(self.__class__.__name__.lower(), self.config) + load_controllers(routes, self.application) + print(routes) def get_wsgi_app(self): config = self.read_config(self.config_filename) assert config, "Missing config." - f = framework_from_config(self.__class__.__name__.lower(), config) - f.setup_application(self) - load_controllers(f, self.application) - return f.get_wsgi_app() + return self.framework.get_wsgi_app() __all__ = ['Encadre', 'Framework', 'Controller', 'validate'] diff --git a/setup.py b/setup.py @@ -6,7 +6,7 @@ encadre-test-app-dump-routes = encadre_test_app:dump_routes """ setup(name='encadre', - version='0.1.2', + version='0.1.3', description="Encadre framework", author="Jean Schurger", author_email='jean@schurger.org',