From 317e59df4b3da37db3001c1d2964e18993b8a91b Mon Sep 17 00:00:00 2001 From: Ozzieisaacs Date: Sat, 15 Feb 2020 16:02:31 +0100 Subject: [PATCH] Bugfixes from tests --- cps/admin.py | 9 ++++----- cps/kobo_auth.py | 2 +- cps/templates/user_edit.html | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cps/admin.py b/cps/admin.py index c051089d..54742345 100644 --- a/cps/admin.py +++ b/cps/admin.py @@ -338,7 +338,6 @@ def restriction_deletion(element, list_func): @login_required @admin_required def add_restriction(type): - log.info("Hit: " + str(type)) element = request.form.to_dict() if type == 0: # Tags as template if 'submit_allow' in element: @@ -713,6 +712,10 @@ def new_user(): languages=languages, title=_(u"Add new user"), page="newuser", kobo_support=kobo_support, registered_oauth=oauth_check) try: + content.allowed_tags = config.config_allowed_tags + content.denied_tags = config.config_denied_tags + content.allowed_column_value = config.config_allowed_column_value + content.denied_column_value = config.config_denied_column_value ub.session.add(content) ub.session.commit() flash(_(u"User '%(user)s' created", user=content.nickname), category="success") @@ -723,10 +726,6 @@ def new_user(): else: content.role = config.config_default_role content.sidebar_view = config.config_default_show - content.allowed_tags = config.config_allowed_tags - content.denied_tags = config.config_denied_tags - content.allowed_column_value = config.config_allowed_column_value - content.allowed_column_value = config.config_denied_column_value return render_title_template("user_edit.html", new_user=1, content=content, translations=translations, languages=languages, title=_(u"Add new user"), page="newuser", kobo_support=kobo_support, registered_oauth=oauth_check) diff --git a/cps/kobo_auth.py b/cps/kobo_auth.py index edb110ff..cd2524e7 100644 --- a/cps/kobo_auth.py +++ b/cps/kobo_auth.py @@ -101,7 +101,7 @@ def load_user_from_kobo_request(request): if user is not None: login_user(user) return user - log.info("Received Kobo request without a recognizable auth token.") + log.debug("Received Kobo request without a recognizable auth token.") return kobo_auth = Blueprint("kobo_auth", __name__, url_prefix="/kobo_auth") diff --git a/cps/templates/user_edit.html b/cps/templates/user_edit.html index 7457e5f6..c386542c 100644 --- a/cps/templates/user_edit.html +++ b/cps/templates/user_edit.html @@ -79,7 +79,7 @@ - {% if ( g.user and g.user.role_admin() ) %} + {% if ( g.user and g.user.role_admin() and not new_user ) %} {{_('Add allowed/denied Tags')}} {{_('Add allowed/denied custom column values')}} {% endif %}