From 667e4c475f8f1683ecb3189726d03c9539d0c5df Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Mon, 5 Sep 2022 07:20:30 +0100 Subject: [PATCH] Add defaults to context and pass them before they are removed --- core/lib/manticore.py | 2 -- core/views/ui/drilldown.py | 9 ++++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/core/lib/manticore.py b/core/lib/manticore.py index 050b022..86d689a 100644 --- a/core/lib/manticore.py +++ b/core/lib/manticore.py @@ -68,9 +68,7 @@ def query_results( sort = None query_created = False source = None - print("BEFORE ADD DEFAULTS", query_params) helpers.add_defaults(query_params) - print("AFTER ADD DEFAULTS", query_params) # Check size if request.user.is_anonymous: sizes = settings.MANTICORE_MAIN_SIZES_ANON diff --git a/core/views/ui/drilldown.py b/core/views/ui/drilldown.py index fa0bb9c..8e293d2 100644 --- a/core/views/ui/drilldown.py +++ b/core/views/ui/drilldown.py @@ -168,12 +168,15 @@ def drilldown_search(request, return_context=False, template=None): # Valid sizes context["sizes"] = sizes - print("BEFORE REMOVE DEFAULT", query_params) + + # Add any default parameters to the context + params_with_defaults = dict(query_params) + helpers.add_defaults(params_with_defaults) + context["params"] = params_with_defaults + helpers.remove_defaults(query_params) - print("AFTER REMOVE DEFAULT", query_params) url_params = urllib.parse.urlencode(query_params) context["client_uri"] = url_params - context["params"] = query_params if "message" in context: if return_context: return context