summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAngel Velásquez <angvp@archlinux.org>2017-05-17 20:45:51 -0400
committerGitHub <noreply@github.com>2017-05-17 20:45:51 -0400
commitf6887d0572f8781c31f72d31115e671d3da3e1a0 (patch)
tree4613f4ae8ba5e4a924ff8c43bcf6e92e1213dea1
parent1d8dd5079526b2855391fb6c6408e474568f28f0 (diff)
parent457f14f1cef3c7ed50d2bf2dcaf10cfce7da63dc (diff)
downloadarchweb-f6887d0572f8781c31f72d31115e671d3da3e1a0.tar.gz
archweb-f6887d0572f8781c31f72d31115e671d3da3e1a0.zip
Merge pull request #13 from jelly/upgrade_django
[RFC] Upgrade django
-rw-r--r--devel/management/commands/reporead.py3
-rw-r--r--local_settings.py.example1
-rw-r--r--main/templatetags/details_link.py (renamed from packages/templatetags/jinja2.py)62
-rw-r--r--main/templatetags/flags.py37
-rw-r--r--mirrors/templatetags/jinja2.py53
-rw-r--r--requirements.txt4
-rw-r--r--requirements_prod.txt2
-rw-r--r--settings.py49
-rw-r--r--templates/mirrors/error_table.html (renamed from templates/mirrors/error_table.html.jinja)10
-rw-r--r--templates/mirrors/mirror_details.html4
-rw-r--r--templates/mirrors/mirror_details_urls.html (renamed from templates/mirrors/mirror_details_urls.html.jinja)18
-rw-r--r--templates/mirrors/status.html6
-rw-r--r--templates/mirrors/status_table.html29
-rw-r--r--templates/mirrors/status_table.html.jinja28
-rw-r--r--templates/mirrors/url_details.html2
-rw-r--r--templates/mirrors/url_details_logs.html (renamed from templates/mirrors/url_details_logs.html.jinja)10
-rw-r--r--templates/packages/details.html2
-rw-r--r--templates/packages/details_depend.html (renamed from templates/packages/details_depend.html.jinja)8
-rw-r--r--templates/packages/details_link.html1
-rw-r--r--templates/packages/details_link.html.jinja1
-rw-r--r--templates/packages/details_relatedto.html3
-rw-r--r--templates/packages/details_relatedto.html.jinja3
-rw-r--r--templates/packages/details_requiredby.html (renamed from templates/packages/details_requiredby.html.jinja)2
-rw-r--r--templates/packages/files.html2
-rw-r--r--templates/packages/files_list.html (renamed from templates/packages/files_list.html.jinja)0
-rw-r--r--templates/packages/package_details.html (renamed from templates/packages/details.html.jinja)88
-rw-r--r--templates/sitemaps/news_sitemap.xml (renamed from templates/sitemaps/news_sitemap.xml.jinja)4
-rw-r--r--templates/sitemaps/sitemap.xml (renamed from templates/sitemaps/sitemap.xml.jinja)2
-rw-r--r--urls.py4
29 files changed, 210 insertions, 228 deletions
diff --git a/devel/management/commands/reporead.py b/devel/management/commands/reporead.py
index 70526bfd..41bbdc72 100644
--- a/devel/management/commands/reporead.py
+++ b/devel/management/commands/reporead.py
@@ -333,7 +333,8 @@ def update_common(archname, reponame, pkgs, sanity_check=True):
# necessary to guard against simultaneous updates.
with transaction.atomic():
# force the transaction dirty, even though we will only do reads
- transaction.set_dirty()
+ # https://github.com/django/django/blob/3c447b108ac70757001171f7a4791f493880bf5b/docs/releases/1.3.txt#L606
+ #transaction.set_dirty()
repository = Repo.objects.get(name__iexact=reponame)
architecture = Arch.objects.get(name=archname)
diff --git a/local_settings.py.example b/local_settings.py.example
index ffd6d8a6..d5c20063 100644
--- a/local_settings.py.example
+++ b/local_settings.py.example
@@ -1,6 +1,5 @@
## Debug settings
DEBUG = False
-TEMPLATE_DEBUG = False
#DEBUG_TOOLBAR = True
## For django debug toolbar
diff --git a/packages/templatetags/jinja2.py b/main/templatetags/details_link.py
index 88b59a96..b94f8487 100644
--- a/packages/templatetags/jinja2.py
+++ b/main/templatetags/details_link.py
@@ -1,19 +1,8 @@
from urllib import urlencode, quote as urlquote, unquote
-from django.utils.html import escape
-from django_jinja import library
+from django import template
from main.templatetags import pgp
-
-@library.filter
-def url_unquote(original_url):
- try:
- url = original_url
- if isinstance(url, unicode):
- url = url.encode('ascii')
- url = unquote(url).decode('utf-8')
- return url
- except UnicodeError:
- return original_url
+register = template.Library()
def link_encode(url, query):
@@ -24,12 +13,12 @@ def link_encode(url, query):
return "%s?%s" % (url, data)
-@library.global_function
-def pgp_key_link(key_id, link_text=None):
- return pgp.pgp_key_link(key_id, link_text)
+@register.inclusion_tag('packages/details_link.html')
+def details_link(pkg):
+ return {'pkg': pkg}
-@library.global_function
+@register.simple_tag
def scm_link(package, operation):
parts = (package.repo.svn_root, operation, package.pkgbase)
linkbase = (
@@ -38,16 +27,7 @@ def scm_link(package, operation):
return linkbase % tuple(urlquote(part.encode('utf-8')) for part in parts)
-@library.global_function
-def wiki_link(package):
- url = "https://wiki.archlinux.org/index.php/Special:Search"
- data = {
- 'search': package.pkgname,
- }
- return link_encode(url, data)
-
-
-@library.global_function
+@register.simple_tag
def bugs_list(package):
url = "https://bugs.archlinux.org/"
data = {
@@ -58,7 +38,7 @@ def bugs_list(package):
return link_encode(url, data)
-@library.global_function
+@register.simple_tag
def bug_report(package):
url = "https://bugs.archlinux.org/newtask"
data = {
@@ -68,4 +48,30 @@ def bug_report(package):
}
return link_encode(url, data)
+
+@register.simple_tag
+def wiki_link(package):
+ url = "https://wiki.archlinux.org/index.php/Special:Search"
+ data = {
+ 'search': package.pkgname,
+ }
+ return link_encode(url, data)
+
+
+@register.simple_tag
+def pgp_key_link(key_id, link_text=None):
+ return pgp.pgp_key_link(key_id, link_text)
+
+
+@register.filter
+def url_unquote(original_url):
+ try:
+ url = original_url
+ if isinstance(url, unicode):
+ url = url.encode('ascii')
+ url = unquote(url).decode('utf-8')
+ return url
+ except UnicodeError:
+ return original_url
+
# vim: set ts=4 sw=4 et:
diff --git a/main/templatetags/flags.py b/main/templatetags/flags.py
index 5b356561..d50ee51d 100644
--- a/main/templatetags/flags.py
+++ b/main/templatetags/flags.py
@@ -1,3 +1,4 @@
+from datetime import timedelta
from django import template
register = template.Library()
@@ -10,4 +11,40 @@ def country_flag(country):
return '<span class="fam-flag fam-flag-%s" title="%s"></span> ' % (
unicode(country.code).lower(), unicode(country.name))
+@register.filter
+def percentage(value, arg=1):
+ if not value and type(value) != float:
+ return u''
+ new_val = value * 100.0
+ return '%.*f%%' % (arg, new_val)
+
+@register.filter
+def duration(value):
+ if not value and type(value) != timedelta:
+ return u''
+ # does not take microseconds into account
+ total_secs = value.seconds + value.days * 24 * 3600
+ mins = total_secs // 60
+ hrs, mins = divmod(mins, 60)
+ return '%d:%02d' % (hrs, mins)
+
+@register.filter
+def floatvalue(value, arg=2):
+ if value is None:
+ return u''
+ return '%.*f' % (arg, value)
+
+
+@register.filter
+def hours(value):
+ if not value and type(value) != timedelta:
+ return u''
+ # does not take microseconds into account
+ total_secs = value.seconds + value.days * 24 * 3600
+ mins = total_secs // 60
+ hrs, mins = divmod(mins, 60)
+ if hrs == 1:
+ return '%d hour' % hrs
+ return '%d hours' % hrs
+
# vim: set ts=4 sw=4 et:
diff --git a/mirrors/templatetags/jinja2.py b/mirrors/templatetags/jinja2.py
deleted file mode 100644
index 04e50238..00000000
--- a/mirrors/templatetags/jinja2.py
+++ /dev/null
@@ -1,53 +0,0 @@
-from datetime import timedelta
-from django_jinja import library
-from markupsafe import Markup
-
-
-@library.global_function
-def country_flag(country):
- if not country:
- return ''
- html = '<span class="fam-flag fam-flag-%s" title="%s"></span> ' % (
- unicode(country.code).lower(), unicode(country.name))
- return Markup(html)
-
-
-@library.filter
-def duration(value):
- if not value and type(value) != timedelta:
- return u''
- # does not take microseconds into account
- total_secs = value.seconds + value.days * 24 * 3600
- mins = total_secs // 60
- hrs, mins = divmod(mins, 60)
- return '%d:%02d' % (hrs, mins)
-
-
-@library.filter
-def hours(value):
- if not value and type(value) != timedelta:
- return u''
- # does not take microseconds into account
- total_secs = value.seconds + value.days * 24 * 3600
- mins = total_secs // 60
- hrs, mins = divmod(mins, 60)
- if hrs == 1:
- return '%d hour' % hrs
- return '%d hours' % hrs
-
-
-@library.filter
-def floatvalue(value, arg=2):
- if value is None:
- return u''
- return '%.*f' % (arg, value)
-
-
-@library.filter
-def percentage(value, arg=1):
- if not value and type(value) != float:
- return u''
- new_val = value * 100.0
- return '%.*f%%' % (arg, new_val)
-
-# vim: set ts=4 sw=4 et:
diff --git a/requirements.txt b/requirements.txt
index 8128b451..a807da1f 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,12 +1,10 @@
-e git+git://github.com/fredj/cssmin.git@master#egg=cssmin
-Django==1.7.11
+Django==1.8.18
IPy==0.83
-Jinja2==2.7.3
Markdown==2.6.2
MarkupSafe==0.23
bencode==1.0
django-countries==3.3
-django-jinja==1.3.3
jsmin==2.1.1
pgpdump==1.5
pytz>=2015.4
diff --git a/requirements_prod.txt b/requirements_prod.txt
index bcb30f3e..7d311e3e 100644
--- a/requirements_prod.txt
+++ b/requirements_prod.txt
@@ -1,12 +1,10 @@
-e git+git://github.com/fredj/cssmin.git@master#egg=cssmin
Django==1.7.8
IPy==0.83
-Jinja2==2.7.3
Markdown==2.6.2
MarkupSafe==0.23
bencode==1.0
django-countries==3.3
-django-jinja==1.3.3
jsmin==2.1.1
pgpdump==1.5
psycopg2==2.6.1
diff --git a/settings.py b/settings.py
index 8043bc4c..4a0ca9d2 100644
--- a/settings.py
+++ b/settings.py
@@ -3,7 +3,6 @@ import os
## Set the debug values
DEBUG = False
-TEMPLATE_DEBUG = DEBUG
DEBUG_TOOLBAR = False
## Notification admins
@@ -45,27 +44,25 @@ LOGIN_REDIRECT_URL = '/'
# Set django's User stuff to use our profile model
AUTH_PROFILE_MODULE = 'devel.UserProfile'
-# We add a processor to determine if the request is secure or not
-TEMPLATE_CONTEXT_PROCESSORS = (
- 'django.contrib.auth.context_processors.auth',
- 'django.core.context_processors.debug',
- 'django.contrib.messages.context_processors.messages',
- 'main.context_processors.secure',
-)
-
-TEMPLATE_DIRS = (
- # Put strings here, like "/home/html/django_templates".
- # Always use forward slashes, even on Windows.
- '%s/templates' % DEPLOY_PATH,
-)
-
-TEMPLATE_LOADERS = (
- 'django_jinja.loaders.FileSystemLoader',
- 'django_jinja.loaders.AppLoader',
-)
-
-# Send templates matching the following to the Jinja2 engine
-DEFAULT_JINJA2_TEMPLATE_EXTENSION = '.jinja'
+from os import path
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': [
+ path.join(DEPLOY_PATH, 'templates')
+ ],
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'debug': DEBUG,
+ 'context_processors': [
+ 'django.contrib.auth.context_processors.auth',
+ 'django.core.context_processors.debug',
+ 'django.contrib.messages.context_processors.messages',
+ 'main.context_processors.secure',
+ ],
+ }
+ }
+]
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
@@ -117,7 +114,6 @@ INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.staticfiles',
'django_countries',
- 'django_jinja',
'main',
'mirrors',
@@ -194,13 +190,6 @@ try:
except ImportError:
pass
-# Enable caching templates in production environments
-if not TEMPLATE_DEBUG:
- TEMPLATE_LOADERS = (
- ('django.template.loaders.cached.Loader', TEMPLATE_LOADERS),
- )
- JINJA2_BYTECODE_CACHE_ENABLE = True
-
# Enable the debug toolbar if requested
if DEBUG_TOOLBAR:
MIDDLEWARE_CLASSES = \
diff --git a/templates/mirrors/error_table.html.jinja b/templates/mirrors/error_table.html
index 132aae63..03de4944 100644
--- a/templates/mirrors/error_table.html.jinja
+++ b/templates/mirrors/error_table.html
@@ -1,3 +1,5 @@
+{% load flags %}
+
<table id="errorlog_mirrors" class="results">
<thead>
<tr>
@@ -11,14 +13,14 @@
</tr>
</thead>
<tbody>
- {% for log in error_logs %}<tr class="{{ loop.cycle('odd', 'even') }}">
+ {% for log in error_logs %}<tr class="{% cycle 'odd' 'even' %}">
<td>{{ log.url.url }}</td>
<td>{{ log.url.protocol.protocol }}</td>
- <td class="country">{{ country_flag(log.url.country) }}{{ log.url.country.name }}</td>
+ <td class="country">{% country_flag log.url.country %}{{ log.url.country.name }}</td>
<td class="wrap">{{ log.error|linebreaksbr }}</td>
- <td>{{ log.last_occurred|date('Y-m-d H:i') }}</td>
+ <td>{{ log.last_occurred|date:'Y-m-d H:i' }}</td>
<td>{{ log.error_count }}</td>
- <td><a href="{{ log.url.get_absolute_url() }}">details</a></td>
+ <td><a href="{{ log.url.get_absolute_url }}">details</a></td>
</tr>{% endfor %}
</tbody>
</table>
diff --git a/templates/mirrors/mirror_details.html b/templates/mirrors/mirror_details.html
index 64009380..401a57e7 100644
--- a/templates/mirrors/mirror_details.html
+++ b/templates/mirrors/mirror_details.html
@@ -93,10 +93,10 @@
</table>
<h3>Available URLs</h3>
- {% include "mirrors/mirror_details_urls.html.jinja" %}
+ {% include "mirrors/mirror_details_urls.html" %}
<h3>Error Log</h3>
- {% include "mirrors/error_table.html.jinja" %}
+ {% include "mirrors/error_table.html" %}
</div>
<div class="box">
diff --git a/templates/mirrors/mirror_details_urls.html.jinja b/templates/mirrors/mirror_details_urls.html
index 7ab1548b..4cada31e 100644
--- a/templates/mirrors/mirror_details_urls.html.jinja
+++ b/templates/mirrors/mirror_details_urls.html
@@ -1,3 +1,5 @@
+{% load flags %}
+
<table id="available_urls" class="results">
<thead>
<tr>
@@ -17,18 +19,18 @@
</thead>
<tbody>
{% for m_url in urls %}
- <tr class="{{ loop.cycle('odd', 'even') }}">
+ <tr class="{% cycle 'odd' 'even' %}">
<td>{% if m_url.protocol.is_download %}<a href="{{ m_url.url }}">{{ m_url.url }}</a>{% else %}{{ m_url.url }}{% endif %}</td>
<td>{{ m_url.protocol }}</td>
- <td class="country">{{ country_flag(m_url.country) }}{{ m_url.country.name }}</td>
+ <td class="country">{% country_flag m_url.country %}{{ m_url.country.name }}</td>
<td>{{ m_url.has_ipv4|yesno|capfirst }}</td>
<td>{{ m_url.has_ipv6|yesno|capfirst }}</td>
- <td>{{ m_url.last_sync|date('Y-m-d H:i')|default('unknown') }}</td>
- <td>{{ m_url.completion_pct|percentage(1) }}</td>
- <td>{{ m_url.delay|duration|default('unknown') }}</td>
- <td>{{ m_url.duration_avg|floatvalue(2) }}</td>
- <td>{{ m_url.duration_stddev|floatvalue(2) }}</td>
- <td>{{ m_url.score|floatvalue(1)|default('∞') }}</td>
+ <td>{{ m_url.last_sync|date:'Y-m-d H:i'|default:'unknown' }}</td>
+ <td>{{ m_url.completion_pct|percentage:1 }}</td>
+ <td>{{ m_url.delay|duration|default:'unknown' }}</td>
+ <td>{{ m_url.duration_avg|floatvalue:2 }}</td>
+ <td>{{ m_url.duration_stddev|floatvalue:2 }}</td>
+ <td>{{ m_url.score|floatvalue:1|default:'∞' }}</td>
<td><a href="{{ m_url.id }}/">Details</a></td>
</tr>
{% endfor %}
diff --git a/templates/mirrors/status.html b/templates/mirrors/status.html
index 530e3ff5..24408be7 100644
--- a/templates/mirrors/status.html
+++ b/templates/mirrors/status.html
@@ -60,18 +60,18 @@
<a name="outofsync" id="outofsync"></a>
<h3>Out of Sync Mirrors</h3>
{% with urls=bad_urls table_id='outofsync_mirrors' %}
- {% include "mirrors/status_table.html.jinja" %}
+ {% include "mirrors/status_table.html" %}
{% endwith %}
<a name="successful" id="successful"></a>
<h3>Successfully Syncing Mirrors</h3>
{% with urls=good_urls table_id='successful_mirrors' %}
- {% include "mirrors/status_table.html.jinja" %}
+ {% include "mirrors/status_table.html" %}
{% endwith %}
<a name="errorlog" id="errorlog"></a>
<h3>Mirror Syncing Error Log</h3>
- {% include "mirrors/error_table.html.jinja" %}
+ {% include "mirrors/error_table.html" %}
</div>
{% endblock %}
diff --git a/templates/mirrors/status_table.html b/templates/mirrors/status_table.html
new file mode 100644
index 00000000..3f8cd2d9
--- /dev/null
+++ b/templates/mirrors/status_table.html
@@ -0,0 +1,29 @@
+{% load flags %}
+<table id="{{ table_id }}" class="results">
+ <thead>
+ <tr>
+ <th>Mirror URL</th>
+ <th>Protocol</th>
+ <th>Country</th>
+ <th>Completion %</th>
+ <th>μ Delay (hh:mm)</th>
+ <th>μ Duration (s)</th>
+ <th>σ Duration (s)</th>
+ <th>Mirror Score</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for m_url in urls %}<tr class="{% cycle 'odd' 'even' }}">
+ <td>{{ m_url.url }}</td>
+ <td>{{ m_url.protocol }}</td>
+ <td class="country">{% country_flag m_url.country %}{{ m_url.country.name }}</td>
+ <td>{{ m_url.completion_pct|percentage:1 }}</td>
+ <td>{{ m_url.delay|duration|default:unknown }}</td>
+ <td>{{ m_url.duration_avg|floatvalue:2 }}</td>
+ <td>{{ m_url.duration_stddev|floatvalue:2 }}</td>
+ <td>{{ m_url.score|floatvalue:1|default:'∞' }}</td>
+ <td><a href="{{ m_url.get_absolute_url }}">details</a></td>
+ </tr>{% endfor %}
+ </tbody>
+</table>
diff --git a/templates/mirrors/status_table.html.jinja b/templates/mirrors/status_table.html.jinja
deleted file mode 100644
index 598a1af0..00000000
--- a/templates/mirrors/status_table.html.jinja
+++ /dev/null
@@ -1,28 +0,0 @@
-<table id="{{ table_id }}" class="results">
- <thead>
- <tr>
- <th>Mirror URL</th>
- <th>Protocol</th>
- <th>Country</th>
- <th>Completion %</th>
- <th>μ Delay (hh:mm)</th>
- <th>μ Duration (s)</th>
- <th>σ Duration (s)</th>
- <th>Mirror Score</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- {% for m_url in urls %}<tr class="{{ loop.cycle('odd', 'even') }}">
- <td>{{ m_url.url }}</td>
- <td>{{ m_url.protocol }}</td>
- <td class="country">{{ country_flag(m_url.country) }}{{ m_url.country.name }}</td>
- <td>{{ m_url.completion_pct|percentage(1) }}</td>
- <td>{{ m_url.delay|duration|default('unknown') }}</td>
- <td>{{ m_url.duration_avg|floatvalue(2) }}</td>
- <td>{{ m_url.duration_stddev|floatvalue(2) }}</td>
- <td>{{ m_url.score|floatvalue(1)|default('∞') }}</td>
- <td><a href="{{ m_url.get_absolute_url() }}">details</a></td>
- </tr>{% endfor %}
- </tbody>
-</table>
diff --git a/templates/mirrors/url_details.html b/templates/mirrors/url_details.html
index b61033cd..2454eda4 100644
--- a/templates/mirrors/url_details.html
+++ b/templates/mirrors/url_details.html
@@ -57,7 +57,7 @@
</table>
<h3>Check Logs</h3>
- {% include "mirrors/url_details_logs.html.jinja" %}
+ {% include "mirrors/url_details_logs.html" %}
</div>
{% endblock %}
diff --git a/templates/mirrors/url_details_logs.html.jinja b/templates/mirrors/url_details_logs.html
index 51f54931..a87e58d4 100644
--- a/templates/mirrors/url_details_logs.html.jinja
+++ b/templates/mirrors/url_details_logs.html
@@ -1,3 +1,5 @@
+{% load flags %}
+
<table id="check_logs" class="results">
<thead>
<tr>
@@ -12,11 +14,11 @@
</tr>
</thead>
<tbody>
- {% for log in logs %}<tr class="{{ loop.cycle('odd', 'even') }}">
- <td>{{ log.check_time|date('Y-m-d H:i') }}</td>
- <td class="country">{% if log.location %}{{ country_flag(log.location.country) }}{{ log.location.country.name }}{% else %}Unknown{% endif %}</td>
+ {% for log in logs %}<tr class="{% cycle 'odd' 'even' %}">
+ <td>{{ log.check_time|date:'Y-m-d H:i' }}</td>
+ <td class="country">{% if log.location %}{% country_flag log.location.country %}{{ log.location.country.name }}{% else %}Unknown{% endif %}</td>
<td>{% if log.location %}{{ log.location.source_ip }}{% else %}Unknown{% endif %}</td>
- <td>{{ log.last_sync|date('Y-m-d H:i') }}</td>
+ <td>{{ log.last_sync|date:'Y-m-d H:i' }}</td>
<td>{{ log.delay|duration }}</td>
<td>{{ log.duration|floatvalue }}</td>
<td>{{ log.is_success|yesno|capfirst }}</td>
diff --git a/templates/packages/details.html b/templates/packages/details.html
index 7a0f8e88..2851abd6 100644
--- a/templates/packages/details.html
+++ b/templates/packages/details.html
@@ -5,7 +5,7 @@
{% block navbarclass %}anb-packages{% endblock %}
{% block content %}
-{% include "packages/details.html.jinja" %}
+{% include "packages/package_details.html" %}
{% endblock %}
{% block script_block %}
diff --git a/templates/packages/details_depend.html.jinja b/templates/packages/details_depend.html
index a2d3a010..f471bc66 100644
--- a/templates/packages/details_depend.html.jinja
+++ b/templates/packages/details_depend.html
@@ -1,8 +1,8 @@
-{% import 'packages/details_link.html.jinja' as details %}<li>{% if depend.pkg == None %}
-{% if depend.providers %}{{ depend.dep.name }}{{ depend.dep.comparison|default("", true) }}{{ depend.dep.version|default("", true) }} <span class="virtual-dep">({% for pkg in depend.providers %}{{ details.details_link(pkg) }}{% if not loop.last %}, {% endif %}{% endfor %})</span>
-{% else %}{{ depend.dep.name }}{{ depend.dep.comparison|default("", true) }}{{ depend.dep.version|default("", true) }} <span class="virtual-dep">(virtual)</span>
+{% load details_link %}<li>{% if depend.pkg == None %}
+{% if depend.providers %}{{ depend.dep.name }}{{ depend.dep.comparison|default:"" }}{{ depend.dep.version|default:"" }} <span class="virtual-dep">({% for pkg in depend.providers %}{% details_link pkg %}{% if not forloop.last %}, {% endif %}{% endfor %})</span>
+{% else %}{{ depend.dep.name }}{{ depend.dep.comparison|default:"" }}{{ depend.dep.version|default:"" }} <span class="virtual-dep">(virtual)</span>
{% endif %}{% else %}
-{{ details.details_link(depend.pkg) }}{{ depend.dep.comparison|default("", true) }}{{ depend.dep.version|default("", true) }}
+{% details_link depend.pkg %}{{ depend.dep.comparison|default:"" }}{{ depend.dep.version|default:"" }}
{% if depend.pkg.repo.testing %} <span class="testing-dep"> (testing)</span>
{% endif %}{% if depend.pkg.repo.staging %} <span class="staging-dep"> (staging)</span>
{% endif %}{% endif %}
diff --git a/templates/packages/details_link.html b/templates/packages/details_link.html
new file mode 100644
index 00000000..87d66d6a
--- /dev/null
+++ b/templates/packages/details_link.html
@@ -0,0 +1 @@
+<a href="{{ pkg.get_absolute_url }}" title="View package details for {{ pkg.pkgname }}">{{ pkg.pkgname }}</a>
diff --git a/templates/packages/details_link.html.jinja b/templates/packages/details_link.html.jinja
deleted file mode 100644
index b7e75fe5..00000000
--- a/templates/packages/details_link.html.jinja
+++ /dev/null
@@ -1 +0,0 @@
-{% macro details_link(pkg) %}<a href="{{ pkg.get_absolute_url() }}" title="View package details for {{ pkg.pkgname }}">{{ pkg.pkgname }}</a>{% endmacro %}
diff --git a/templates/packages/details_relatedto.html b/templates/packages/details_relatedto.html
new file mode 100644
index 00000000..560a67f8
--- /dev/null
+++ b/templates/packages/details_relatedto.html
@@ -0,0 +1,3 @@
+{% load details_link %}{% for related in all_related %}{% with best_satisfier=related.get_best_satisfier %}
+<span class="related">{% if best_satisfier == None %}{{ related.name }}{% else %}{% details_link best_satisfier %}{% endif %}{{ related.comparison|default:'' }}{{ related.version|default:'' }}{% if not forloop.last %}, {% endif %}</span>
+{% endwith %}{% endfor %}
diff --git a/templates/packages/details_relatedto.html.jinja b/templates/packages/details_relatedto.html.jinja
deleted file mode 100644
index 818224de..00000000
--- a/templates/packages/details_relatedto.html.jinja
+++ /dev/null
@@ -1,3 +0,0 @@
-{% import 'packages/details_link.html.jinja' as details %}{% for related in all_related %}{% with best_satisfier = related.get_best_satisfier() %}
-<span class="related">{% if best_satisfier == None %}{{ related.name }}{% else %}{{ details.details_link(best_satisfier) }}{% endif %}{{ related.comparison|default('', true) }}{{ related.version|default('', true) }}{% if not loop.last %}, {% endif %}</span>
-{% endwith %}{% endfor %}
diff --git a/templates/packages/details_requiredby.html.jinja b/templates/packages/details_requiredby.html
index b083a7fc..c8084649 100644
--- a/templates/packages/details_requiredby.html.jinja
+++ b/templates/packages/details_requiredby.html
@@ -1,4 +1,4 @@
-{% import 'packages/details_link.html.jinja' as details %}<li>{{ details.details_link(req.pkg) }}
+{% load details_link %}<li>{% details_link req.pkg %}
{% if req.name != pkg.pkgname %}<span class="virtual-dep"> (requires {{ req.name }})</span>
{% endif %}{% if req.pkg.repo.testing %}<span class="testing-dep"> (testing)</span>
{% endif %}{% if req.pkg.repo.staging %}<span class="staging-dep"> (staging)</span>
diff --git a/templates/packages/files.html b/templates/packages/files.html
index 879fcbff..3e718ed0 100644
--- a/templates/packages/files.html
+++ b/templates/packages/files.html
@@ -9,7 +9,7 @@
<p>Package has {{ files_count }} file{{ files_count|pluralize }} and {{ dir_count }} director{{ dir_count|pluralize:"y,ies" }}.</p>
<p><a href="{{ pkg.get_absolute_url }}">Back to Package</a></p>
<div id="metadata"><div id="pkgfilelist">
- {% include "packages/files_list.html.jinja" %}
+ {% include "packages/files_list.html" %}
</div></div>
</div>
diff --git a/templates/packages/files_list.html.jinja b/templates/packages/files_list.html
index ab3e1210..ab3e1210 100644
--- a/templates/packages/files_list.html.jinja
+++ b/templates/packages/files_list.html
diff --git a/templates/packages/details.html.jinja b/templates/packages/package_details.html
index 9a72622d..d7c142e1 100644
--- a/templates/packages/details.html.jinja
+++ b/templates/packages/package_details.html
@@ -1,4 +1,4 @@
-{% import 'packages/details_link.html.jinja' as details %}
+{% load details_link %}
<div id="pkgdetails" class="box">
<h2>{{ pkg.pkgname }} {{ pkg.full_version }}</h2>
@@ -7,19 +7,19 @@
<h4>Package Actions</h4>
<ul class="small">
<li>
- <a href="{{ scm_link(pkg, 'tree') }}" title="View source files for {{ pkg.pkgname }}">Source Files</a> /
- <a href="{{ scm_link(pkg, 'log') }}" title="View changes for {{ pkg.pkgname }}">View Changes</a>
+ <a href="{% scm_link pkg 'tree' %}" title="View source files for {{ pkg.pkgname }}">Source Files</a> /
+ <a href="{% scm_link pkg 'log' %}" title="View changes for {{ pkg.pkgname }}">View Changes</a>
</li>
<li>
- <a href="{{ bugs_list(pkg) }}" title="View existing bug tickets for {{ pkg.pkgname }}">Bug Reports</a> /
- <a href="{{ bug_report(pkg) }}" title="Report new bug for {{ pkg.pkgname }}">Add New Bug</a>
+ <a href="{% bugs_list pkg %}" title="View existing bug tickets for {{ pkg.pkgname }}">Bug Reports</a> /
+ <a href="{% bug_report pkg %}" title="Report new bug for {{ pkg.pkgname }}">Add New Bug</a>
</li>
- <li><a href="{{ wiki_link(pkg) }}" title="Search wiki for {{ pkg.pkgname }}">Search Wiki</a></li>
+ <li><a href="{% wiki_link pkg %}" title="Search wiki for {{ pkg.pkgname }}">Search Wiki</a></li>
{% if pkg.flag_date %}
<li><span class="flagged">Flagged out-of-date on {{ pkg.flag_date|date }}</span></li>
- {% with tp = pkg.in_testing() %}{% if tp %}
+ {% with tp=pkg.in_testing %}{% if tp %}
<li><span class="flagged">Version
- <a href="{{ tp.get_absolute_url() }}"
+ <a href="{{ tp.get_absolute_url }}"
title="Testing package details for {{ tp.pkgname }}">{{ tp.full_version }}</a>
in testing</span></li>
{% endif %}{% endwith %}
@@ -49,12 +49,12 @@
{% endif %}
</div>
- {% with others = pkg.elsewhere() %}{% if others %}
+ {% with others=pkg.elsewhere %}{% if others %}
<div id="elsewhere" class="widget">
<h4>Versions Elsewhere</h4>
<ul>
{% for o in others %}
- <li><a href="{{ o.get_absolute_url() }}"
+ <li><a href="{{ o.get_absolute_url }}"
title="Package details for {{ o.pkgname }}">{{ o.pkgname }} {{ o.full_version }} [{{ o.repo.name|lower }}] ({{ o.arch.name }})</a></li>
{% endfor %}
</ul>
@@ -67,11 +67,11 @@
<meta itemprop="version" content="{{ pkg.full_version|escape }}"/>
<meta itemprop="softwareVersion" content="{{ pkg.full_version|escape }}"/>
<meta itemprop="fileSize" content="{{ pkg.compressed_size }}"/>
- <meta itemprop="dateCreated" content="{{ pkg.build_date|date("Y-m-d") }}"/>
- <meta itemprop="datePublished" content="{{ pkg.last_update|date("Y-m-d") }}"/>
+ <meta itemprop="dateCreated" content="{{ pkg.build_date|date:"Y-m-d" }}"/>
+ <meta itemprop="datePublished" content="{{ pkg.last_update|date:"Y-m-d" }}"/>
<meta itemprop="operatingSystem" content="Arch Linux"/>
{% if pkg.packager %}<div style="display:none" itemprop="provider" itemscope itemtype="http://schema.org/Person">
- <meta itemprop="name" content="{{ pkg.packager.get_full_name()|escape }}"/>
+ <meta itemprop="name" content="{{ pkg.packager.get_full_name|escape }}"/>
</div>{% endif %}
<table id="pkginfo">
<tr>
@@ -84,17 +84,17 @@
title="Browse the {{ pkg.repo.name|capfirst }} repository">{{ pkg.repo.name|capfirst }}</a></td>
</tr>
{% if pkg.pkgname == pkg.pkgbase %}
- {% with splits = pkg.split_packages() %}{% if splits %}
+ {% with splits=pkg.split_packages %}{% if splits %}
<tr>
<th>Split Packages:</th>
- <td class="wrap relatedto">{% for s in splits %}<span class="related">{{ details.details_link(s) }}{% if not loop.last %}, {% endif %}</span>{% endfor %}</td>
+ <td class="wrap relatedto">{% for s in splits %}<span class="related">{% details_link s %}{% if not forloop.last %}, {% endif %}</span>{% endfor %}</td>
</tr>
{% endif %}{% endwith %}
{% else %}
<tr>
<th>Base Package:</th>
- {% with base = pkg.base_package() %}{% if base %}
- <td>{{ details.details_link(base) }}</td>
+ {% with base=pkg.base_package %}{% if base %}
+ <td>{% details_link base %}</td>
{% else %}
<td><a href="../{{ pkg.pkgbase }}/"
title="Split package details for {{ pkg.pkgbase }}">{{ pkg.pkgbase }}</a></td>
@@ -103,55 +103,55 @@
{% endif %}
<tr>
<th>Description:</th>
- <td class="wrap" itemprop="description">{{ pkg.pkgdesc|default("", true) }}</td>
+ <td class="wrap" itemprop="description">{{ pkg.pkgdesc|default:"" }}</td>
</tr><tr>
<th>Upstream URL:</th>
<td>{% if pkg.url %}<a itemprop="url" href="{{ pkg.url }}"
title="Visit the website for {{ pkg.pkgname }}">{{ pkg.url|url_unquote }}</a>{% endif %}</td>
</tr><tr>
<th>License(s):</th>
- <td class="wrap">{{ pkg.licenses.all()|join(", ") }}</td>
+ <td class="wrap">{{ pkg.licenses.all|join:", " }}</td>
</tr>
- {% with groups = pkg.groups.all() %}{% if groups %}
+ {% with groups=pkg.groups.all %}{% if groups %}
<tr>
<th>Groups:</th>
<td class="wrap">{% for g in groups %}
<a href="/groups/{{ pkg.arch.name }}/{{ g.name }}/"
- title="Group details for {{ g.name }}">{{ g.name }}</a>{% if not loop.last %}, {% endif %}{% endfor %}
+ title="Group details for {{ g.name }}">{{ g.name }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}
</td>
</tr>
{% endif %}{% endwith %}
- {% with all_related = pkg.provides.all() %}{% if all_related %}
+ {% with all_related=pkg.provides.all %}{% if all_related %}
<tr>
<th>Provides:</th>
- <td class="wrap relatedto">{% include "packages/details_relatedto.html.jinja" %}</td>
+ <td class="wrap relatedto">{% include "packages/details_relatedto.html" %}</td>
</tr>
{% endif %}{% endwith %}
- {% with all_related = pkg.replaces.all() %}{% if all_related %}
+ {% with all_related=pkg.replaces.all %}{% if all_related %}
<tr>
<th>Replaces:</th>
- <td class="wrap relatedto">{% include "packages/details_relatedto.html.jinja" %}</td>
+ <td class="wrap relatedto">{% include "packages/details_relatedto.html" %}</td>
</tr>
{% endif %}{% endwith %}
- {% with all_related = pkg.conflicts.all() %}{% if all_related %}
+ {% with all_related=pkg.conflicts.all %}{% if all_related %}
<tr>
<th>Conflicts:</th>
- <td class="wrap relatedto">{% include "packages/details_relatedto.html.jinja" %}</td>
+ <td class="wrap relatedto">{% include "packages/details_relatedto.html" %}</td>
</tr>
{% endif %}{% endwith %}
- {% with rev_conflicts = pkg.reverse_conflicts() %}{% if rev_conflicts %}
+ {% with rev_conflicts=pkg.reverse_conflicts %}{% if rev_conflicts %}
<tr>
<th>Reverse Conflicts:</th>
<td class="wrap relatedto">{% for conflict in rev_conflicts %}
- <span class="related">{{ details.details_link(conflict) }}{% if not loop.last %}, {% endif %}</span>{% endfor %}</td>
+ <span class="related">{% details_link conflict %}{% if not forloop.last %}, {% endif %}</span>{% endfor %}</td>
</tr>
{% endif %}{% endwith %}
<tr>
<th>Maintainers:</th>
- {% with maints = pkg.maintainers %}
+ {% with maints=pkg.maintainers %}
<td>{% if maints %}{% for m in maints %}
<a href="/packages/?maintainer={{ m.username }}"
- title="View packages maintained by {{ m.get_full_name() }}">{{ m.get_full_name() }}</a><br/>
+ title="View packages maintained by {{ m.get_full_name }}">{{ m.get_full_name }}</a><br/>
{% endfor %}{% else %}Orphan{% endif %}
</td>
{% endwith %}
@@ -163,50 +163,50 @@
<td>{{ pkg.installed_size|filesizeformat }}</td>
</tr><tr>
<th>Last Packager:</th>
- <td>{% with pkgr = pkg.packager %}{% if pkgr %}
+ <td>{% with pkgr=pkg.packager %}{% if pkgr %}
<a href="/packages/?packager={{ pkgr.username }}"
- title="View packages packaged by {{ pkgr.get_full_name() }}">{{ pkgr.get_full_name() }}</a>
+ title="View packages packaged by {{ pkgr.get_full_name }}">{{ pkgr.get_full_name }}</a>
{% else %}{{ pkg.packager_str }}{% endif %}{% endwith %}</td>
</tr><tr>
<th>Build Date:</th>
- <td>{{ pkg.build_date|date("DATETIME_FORMAT") }} UTC</td>
+ <td>{{ pkg.build_date|date:"DATETIME_FORMAT" }} UTC</td>
</tr>{% if pkg.signature %}<tr>
<th>Signed By:</th>
- <td>{% with signer = pkg.signer %}{% if signer %}{{ pgp_key_link(pkg.signature.key_id, signer.get_full_name())|safe }}{% else %}Unknown ({{ pgp_key_link(pkg.signature.key_id)|safe }}){% endif %}{% endwith %}</td>
+ <td>{% with signer=pkg.signer %}{% if signer %}{% pgp_key_link pkg.signature.key_id signer.get_full_name|safe %}{% else %}Unknown ({% pgp_key_link pkg.signature.key_id|safe %}){% endif %}{% endwith %}</td>
</tr><tr>
<th>Signature Date:</th>
- <td>{{ pkg.signature.creation_time|date("DATETIME_FORMAT") }} UTC</td>
+ <td>{{ pkg.signature.creation_time|date:"DATETIME_FORMAT" }} UTC</td>
</tr>{% else %}<tr>
<th>Signed By:</th>
<td>Unsigned</td>
</tr>{% endif %}<tr>
<th>Last Updated:</th>
- <td>{{ pkg.last_update|date("DATETIME_FORMAT") }} UTC</td>
+ <td>{{ pkg.last_update|date:"DATETIME_FORMAT" }} UTC</td>
</tr>
- {% if user.is_authenticated() %}{% with flag_request = pkg.flag_request() %}{% if flag_request %}<tr>
+ {% if user.is_authenticated %}{% with flag_request=pkg.flag_request %}{% if flag_request %}<tr>
<th>Last Flag Request:</th>
- <td class="wrap">From {{ flag_request.who() }} on {{ flag_request.created|date }}:<br/>
- <div class="userdata">{{ flag_request.message|linebreaksbr|default("{no message}", true) }}</div></td>
+ <td class="wrap">From {{ flag_request.who }} on {{ flag_request.created|date }}:<br/>
+ <div class="userdata">{{ flag_request.message|linebreaksbr|default:"{no message}" }}</div></td>
</tr>{% endif %}{% endwith %}{% endif %}
</table>
</div>
<div id="metadata">
- {% with deps = pkg.get_depends() %}
+ {% with deps=pkg.get_depends %}
<div id="pkgdeps" class="listing">
<h3 title="{{ pkg.pkgname }} has the following dependencies">
Dependencies ({{deps|length}})</h3>
{% if deps %}<ul id="pkgdepslist">
- {% for depend in deps %}{% include "packages/details_depend.html.jinja" %}{% endfor %}
+ {% for depend in deps %}{% include "packages/details_depend.html" %}{% endfor %}
</ul>{% endif %}
</div>
{% endwith %}
- {% with rqdby = pkg.get_requiredby() %}
+ {% with rqdby=pkg.get_requiredby %}
<div id="pkgreqs" class="listing">
<h3 title="Packages that require {{ pkg.pkgname }}">
Required By ({{rqdby|length}})</h3>
{% if rqdby %}<ul id="pkgreqslist">
- {% for req in rqdby %}{% include "packages/details_requiredby.html.jinja" %}{% endfor %}
+ {% for req in rqdby %}{% include "packages/details_requiredby.html" %}{% endfor %}
</ul>{% endif %}
</div>
{% endwith %}
diff --git a/templates/sitemaps/news_sitemap.xml.jinja b/templates/sitemaps/news_sitemap.xml
index 97dd17b5..1492ecce 100644
--- a/templates/sitemaps/news_sitemap.xml.jinja
+++ b/templates/sitemaps/news_sitemap.xml
@@ -2,12 +2,12 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:news="http://www.google.com/schemas/sitemap-news/0.9">
{% for url in urlset %}<url>
<loc>{{ url.location }}</loc>
-{% if url.lastmod %}<lastmod>{{ url.lastmod|date("Y-m-d") }}</lastmod>{% endif %}
+{% if url.lastmod %}<lastmod>{{ url.lastmod|date:"Y-m-d" }}</lastmod>{% endif %}
{% if url.changefreq %}<changefreq>{{ url.changefreq }}</changefreq>{% endif %}
{% if url.priority %}<priority>{{ url.priority }}</priority>{% endif %}
<news:news>
<news:publication><news:name>Arch Linux News</news:name><news:language>en</news:language></news:publication>
- {% if url.item.postdate %}<news:publication_date>{{ url.item.postdate|date("c") }}</news:publication_date>{% endif %}
+ {% if url.item.postdate %}<news:publication_date>{{ url.item.postdate|date:"c" }}</news:publication_date>{% endif %}
{% if url.item.title %}<news:title>{{ url.item.title }}</news:title>{% endif %}
</news:news>
</url>{% endfor %}
diff --git a/templates/sitemaps/sitemap.xml.jinja b/templates/sitemaps/sitemap.xml
index 0808a7de..50a95237 100644
--- a/templates/sitemaps/sitemap.xml.jinja
+++ b/templates/sitemaps/sitemap.xml
@@ -2,7 +2,7 @@
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% for url in urlset %}<url>
<loc>{{ url.location }}</loc>
-{% if url.lastmod %}<lastmod>{{ url.lastmod|date("Y-m-d") }}</lastmod>{% endif %}
+{% if url.lastmod %}<lastmod>{{ url.lastmod|date:"Y-m-d" }}</lastmod>{% endif %}
{% if url.changefreq %}<changefreq>{{ url.changefreq }}</changefreq>{% endif %}
{% if url.priority %}<priority>{{ url.priority }}</priority>{% endif %}
</url>{% endfor %}
diff --git a/urls.py b/urls.py
index 76271ece..134ce33e 100644
--- a/urls.py
+++ b/urls.py
@@ -84,11 +84,11 @@ urlpatterns += patterns('',
{'sitemaps': our_sitemaps, 'sitemap_url_name': 'sitemaps'}),
(r'^sitemap-(?P<section>.+)\.xml$',
cache_page(1831)(sitemap_views.sitemap),
- {'sitemaps': our_sitemaps, 'template_name': 'sitemaps/sitemap.xml.jinja'},
+ {'sitemaps': our_sitemaps, 'template_name': 'sitemaps/sitemap.xml'},
'sitemaps'),
(r'^news-sitemap\.xml$',
cache_page(1831)(sitemap_views.sitemap),
- {'sitemaps': news_sitemaps, 'template_name': 'sitemaps/news_sitemap.xml.jinja'},
+ {'sitemaps': news_sitemaps, 'template_name': 'sitemaps/news_sitemap.xml'},
'news-sitemap'),
)