From b07ef206b5632ba2b7421f797881142e9a96daa4 Mon Sep 17 00:00:00 2001 From: Antonio de la Rosa Date: Mon, 5 Apr 2021 14:22:39 +0200 Subject: [PATCH] Fix in plugins --- paramecio/citoplasma/plugins.py | 13 +++++++------ paramecio/modules/admin/templates/admin/home.html | 4 ++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/paramecio/citoplasma/plugins.py b/paramecio/citoplasma/plugins.py index f809364..8573ace 100644 --- a/paramecio/citoplasma/plugins.py +++ b/paramecio/citoplasma/plugins.py @@ -9,12 +9,13 @@ class LoginPlugin(object): name = 'login' api = 2 - login_url='login' - def __init__(self, keyword='login'): + def __init__(self, keyword='login', login_var='login', login_url='login'): self.keyword=keyword - + self.login_var=login_var + self.login_url=login_url + def setup(self, app): ''' Make sure that other installed plugins don't affect the same keyword argument.''' @@ -26,10 +27,10 @@ class LoginPlugin(object): def apply(self, callback, context): - # Test if the original callback accepts a 'db' keyword. + # Test if the original callback accepts a 'login' keyword. # Ignore it if it does not need a login handle. - conf = context.config.get('login') or {} + conf = context.config.get(self.keyword) or {} keyword = conf.get('keyword', self.keyword) @@ -42,7 +43,7 @@ class LoginPlugin(object): s=get_session() - if 'login' in s: + if self.login_var in s: rv = callback(*args, **kwargs) diff --git a/paramecio/modules/admin/templates/admin/home.html b/paramecio/modules/admin/templates/admin/home.html index 623ac11..99dff6f 100644 --- a/paramecio/modules/admin/templates/admin/home.html +++ b/paramecio/modules/admin/templates/admin/home.html @@ -11,18 +11,18 @@ ${make_url('admin/'+module)}\ ${title} -${HeaderHTML.css_home()|n} +${HeaderHTML.css_home()|n} <%block name="extra_css"> -${HeaderHTML.js_home()|n} +${HeaderHTML.js_home()|n} <%block name="extra_js"> ${HeaderHTML.header_home()|n}