diff options
author | Ben Sturmfels <ben@sturm.com.au> | 2020-04-09 15:53:49 +1000 |
---|---|---|
committer | Ben Sturmfels <ben@sturm.com.au> | 2020-04-09 15:53:49 +1000 |
commit | 15c45a820f915455c8a1a55d971031aa122d1674 (patch) | |
tree | 309e4ead7b4988444f29b888c82be546b6040ec4 /mediagoblin/templates | |
parent | f9112bd8833d08fc0b7a120c330d213e6e656a33 (diff) | |
download | mediagoblin-15c45a820f915455c8a1a55d971031aa122d1674.tar.lz mediagoblin-15c45a820f915455c8a1a55d971031aa122d1674.tar.xz mediagoblin-15c45a820f915455c8a1a55d971031aa122d1674.zip |
Decode request.query_string before use.
Prior to this change, when pagination kicks in on the user management or report
management panel, the following exception is raised:
TypeError: a bytes-like object is required, not 'str'
The cause is that `request.query_string` in the URL parameters in raw bytestring
form as per Werkzeug documentation.
Diffstat (limited to 'mediagoblin/templates')
-rw-r--r-- | mediagoblin/templates/mediagoblin/moderation/report_panel.html | 12 | ||||
-rw-r--r-- | mediagoblin/templates/mediagoblin/moderation/user_panel.html | 6 |
2 files changed, 9 insertions, 9 deletions
diff --git a/mediagoblin/templates/mediagoblin/moderation/report_panel.html b/mediagoblin/templates/mediagoblin/moderation/report_panel.html index c82cd412..52a6ad87 100644 --- a/mediagoblin/templates/mediagoblin/moderation/report_panel.html +++ b/mediagoblin/templates/mediagoblin/moderation/report_panel.html @@ -35,10 +35,10 @@ <h2>{% trans %}Active Reports Filed{% endtrans %}</h2> {% if report_list.count() %} {% if not active_settings.last_page == 1 %} - {% if 'active_p='~active_settings.current_page in request.query_string %} - {% set query_string = request.query_string %}{% else %} + {% if 'active_p='~active_settings.current_page in request.query_string.decode() %} + {% set query_string = request.query_string.decode() %}{% else %} {% set query_string = -'active_p='~active_settings.current_page~"&"+request.query_string %} +'active_p='~active_settings.current_page~"&"+request.query_string.decode() %} {% endif %} <div class="right_align"> {% set first_vis = active_settings.current_page-3 %} @@ -127,10 +127,10 @@ curr_page !=p %} <h2>{% trans %}Closed Reports{% endtrans %}</h2> {% if closed_report_list.count() %} {% if not closed_settings.last_page == 1 %} - {% if 'closed_p='~closed_settings.current_page in request.query_string %} - {% set query_string = request.query_string %}{% else %} + {% if 'closed_p='~closed_settings.current_page in request.query_string.decode() %} + {% set query_string = request.query_string.decode() %}{% else %} {% set query_string = -'closed_p='~closed_settings.current_page~"&"+request.query_string %} +'closed_p='~closed_settings.current_page~"&"+request.query_string.decode() %} {% endif %} <div class="right_align"> {% set first_vis = closed_settings.current_page-3 %} diff --git a/mediagoblin/templates/mediagoblin/moderation/user_panel.html b/mediagoblin/templates/mediagoblin/moderation/user_panel.html index 4949960e..4046fecd 100644 --- a/mediagoblin/templates/mediagoblin/moderation/user_panel.html +++ b/mediagoblin/templates/mediagoblin/moderation/user_panel.html @@ -35,10 +35,10 @@ {% if user_list.count() %} {% if not last_page == 1 %} - {% if 'p='~current_page in request.query_string %} - {% set query_string = request.query_string %}{% else %} + {% if 'p='~current_page in request.query_string.decode() %} + {% set query_string = request.query_string.decode() %}{% else %} {% set query_string = -'p='~current_page~"&"+request.query_string %} +'p='~current_page~"&"+request.query_string.decode() %} {% endif %} <div class="right_align"> {% set first_vis = current_page-3 %} |