diff --git a/flaschengeist/plugins/pricelist/__init__.py b/flaschengeist/plugins/pricelist/__init__.py index ef19807..b4df1ac 100644 --- a/flaschengeist/plugins/pricelist/__init__.py +++ b/flaschengeist/plugins/pricelist/__init__.py @@ -567,6 +567,7 @@ def get_columns(userid, current_session): userController.persist() return no_content() + @PriceListPlugin.blueprint.route("/users//pricecalc_columns_order", methods=["GET", "PUT"]) @login_required() def get_columns_order(userid, current_session): diff --git a/run_flaschengeist b/run_flaschengeist index 26c10ec..e11271e 100644 --- a/run_flaschengeist +++ b/run_flaschengeist @@ -17,7 +17,7 @@ class PrefixMiddleware(object): def __call__(self, environ, start_response): if environ["PATH_INFO"].startswith(self.prefix): - environ["PATH_INFO"] = environ["PATH_INFO"][len(self.prefix):] + environ["PATH_INFO"] = environ["PATH_INFO"][len(self.prefix) :] environ["SCRIPT_NAME"] = self.prefix return self.app(environ, start_response) else: @@ -83,19 +83,19 @@ class InterfaceGenerator: import typing if ( - inspect.ismodule(module[1]) - and module[1].__name__.startswith(self.basename) - and module[1].__name__ not in self.known + inspect.ismodule(module[1]) + and module[1].__name__.startswith(self.basename) + and module[1].__name__ not in self.known ): self.known.append(module[1].__name__) for cls in inspect.getmembers(module[1], lambda x: inspect.isclass(x) or inspect.ismodule(x)): self.walker(cls) elif ( - inspect.isclass(module[1]) - and module[1].__module__.startswith(self.basename) - and module[0] not in self.classes - and not module[0].startswith("_") - and hasattr(module[1], "__annotations__") + inspect.isclass(module[1]) + and module[1].__module__.startswith(self.basename) + and module[0] not in self.classes + and not module[0].startswith("_") + and hasattr(module[1], "__annotations__") ): self.this_type = module[0] print("\n\n" + module[0] + "\n") @@ -156,12 +156,14 @@ def export(arguments): app = create_app() with app.app_context(): gen = InterfaceGenerator(arguments.namespace, arguments.file) - gen.run(models) - if arguments.plugins: + if not arguments.no_core: + gen.run(models) + if arguments.plugins is not None: for entry_point in pkg_resources.iter_entry_points("flaschengeist.plugin"): - plg = entry_point.load() - if hasattr(plg, "models") and plg.models is not None: - gen.run(plg.models) + if len(arguments.plugins) == 0 or entry_point.name in arguments.plugins: + plg = entry_point.load() + if hasattr(plg, "models") and plg.models is not None: + gen.run(plg.models) gen.write() @@ -183,7 +185,12 @@ if __name__ == "__main__": parser_export.set_defaults(func=export) parser_export.add_argument("--file", help="Filename where to save", default="flaschengeist.d.ts") parser_export.add_argument("--namespace", help="Namespace of declarations", default="FG") - parser_export.add_argument("--plugins", help="Also export plugins", action="store_true") + parser_export.add_argument( + "--no-core", + help="Do not export core declarations (only useful in conjunction with --plugins)", + action="store_true", + ) + parser_export.add_argument("--plugins", help="Also export plugins (none means all)", nargs="*") args = parser.parse_args() args.func(args)