mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
jinja2: rename filter 'urlencode' to 'quote_plus'
urlencode does more than just a quote_plus. Using urlencode was not sensible, so this commit addresses that. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
e15a18e9fb
commit
49cc12f99d
5 changed files with 11 additions and 8 deletions
|
@ -31,7 +31,7 @@ _env.filters["tn"] = l10n.tn
|
||||||
_env.filters["dt"] = util.timestamp_to_datetime
|
_env.filters["dt"] = util.timestamp_to_datetime
|
||||||
_env.filters["as_timezone"] = util.as_timezone
|
_env.filters["as_timezone"] = util.as_timezone
|
||||||
_env.filters["dedupe_qs"] = util.dedupe_qs
|
_env.filters["dedupe_qs"] = util.dedupe_qs
|
||||||
_env.filters["urlencode"] = quote_plus
|
_env.filters["quote_plus"] = quote_plus
|
||||||
_env.filters["get_vote"] = util.get_vote
|
_env.filters["get_vote"] = util.get_vote
|
||||||
_env.filters["number_format"] = util.number_format
|
_env.filters["number_format"] = util.number_format
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import base64
|
import base64
|
||||||
|
import logging
|
||||||
import math
|
import math
|
||||||
import random
|
import random
|
||||||
import re
|
import re
|
||||||
|
@ -18,6 +19,8 @@ from jinja2 import pass_context
|
||||||
|
|
||||||
import aurweb.config
|
import aurweb.config
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
def make_random_string(length):
|
def make_random_string(length):
|
||||||
return ''.join(random.choices(string.ascii_lowercase
|
return ''.join(random.choices(string.ascii_lowercase
|
||||||
|
|
|
@ -42,12 +42,12 @@
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li>
|
<li>
|
||||||
<a href="/login?next={{ request.url.path | urlencode }}">
|
<a href="/login?next={{ request.url.path | quote_plus }}">
|
||||||
{{ "Vote for this package" | tr }}
|
{{ "Vote for this package" | tr }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="/login?next={{ request.url.path | urlencode }}">
|
<a href="/login?next={{ request.url.path | quote_plus }}">
|
||||||
{{ "Enable notifications" | tr }}
|
{{ "Enable notifications" | tr }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -133,7 +133,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li>
|
<li>
|
||||||
{% if not request.user.is_authenticated() %}
|
{% if not request.user.is_authenticated() %}
|
||||||
<a href="/login?next={{ '/pkgbase/%s/request' | format(result.Name) | urlencode }}">
|
<a href="/login?next={{ '/pkgbase/%s/request' | format(result.Name) | quote_plus }}">
|
||||||
{{ "Submit Request" | tr }}
|
{{ "Submit Request" | tr }}
|
||||||
</a>
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<ul id="voters">
|
<ul id="voters">
|
||||||
{% for voter in voters %}
|
{% for voter in voters %}
|
||||||
<li>
|
<li>
|
||||||
<a href="/account/{{ voter.Username | urlencode }}">
|
<a href="/account/{{ voter.Username | quote_plus }}">
|
||||||
{{ voter.Username | e }}
|
{{ voter.Username | e }}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<th>{{ "Proposal" | tr }}</th>
|
<th>{{ "Proposal" | tr }}</th>
|
||||||
<th>
|
<th>
|
||||||
{% set off_qs = "%s=%d" | format(off_param, off) %}
|
{% set off_qs = "%s=%d" | format(off_param, off) %}
|
||||||
{% set by_qs = "%s=%s" | format(by_param, by_next | urlencode) %}
|
{% set by_qs = "%s=%s" | format(by_param, by_next | quote_plus) %}
|
||||||
<a href="?{{ q | dedupe_qs(off_qs, by_qs) }}">
|
<a href="?{{ q | dedupe_qs(off_qs, by_qs) }}">
|
||||||
{{ "Start" | tr }}
|
{{ "Start" | tr }}
|
||||||
</a>
|
</a>
|
||||||
|
@ -95,7 +95,7 @@
|
||||||
|
|
||||||
{% if off > 0 %}
|
{% if off > 0 %}
|
||||||
{% set off_qs = "%s=%d" | format(off_param, off - 10) %}
|
{% set off_qs = "%s=%d" | format(off_param, off - 10) %}
|
||||||
{% set by_qs = "%s=%s" | format(by_param, by | urlencode) %}
|
{% set by_qs = "%s=%s" | format(by_param, by | quote_plus) %}
|
||||||
<a class="page"
|
<a class="page"
|
||||||
href="?{{ q | dedupe_qs(off_qs, by_qs) }}">
|
href="?{{ q | dedupe_qs(off_qs, by_qs) }}">
|
||||||
‹ Back
|
‹ Back
|
||||||
|
@ -104,7 +104,7 @@
|
||||||
|
|
||||||
{% if off < total_votes - pp %}
|
{% if off < total_votes - pp %}
|
||||||
{% set off_qs = "%s=%d" | format(off_param, off + 10) %}
|
{% set off_qs = "%s=%d" | format(off_param, off + 10) %}
|
||||||
{% set by_qs = "%s=%s" | format(by_param, by | urlencode) %}
|
{% set by_qs = "%s=%s" | format(by_param, by | quote_plus) %}
|
||||||
<a class="page"
|
<a class="page"
|
||||||
href="?{{ q | dedupe_qs(off_qs, by_qs) }}">
|
href="?{{ q | dedupe_qs(off_qs, by_qs) }}">
|
||||||
Next ›
|
Next ›
|
||||||
|
|
Loading…
Add table
Reference in a new issue