diff options
46 files changed, 306 insertions, 489 deletions
diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..81cef987 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: python +python: + - "2.7" +install: "pip install -r requirements.txt" + +script: + - python manage.py collectstatic --noinput + - python manage.py test @@ -75,6 +75,16 @@ packages, you will probably want the following: Alter architecture and repo to get x86\_64 and packages from other repos if needed. +# Testing SMTP server + +To be able to create an account on your test environment an SMTP server is +required. A simple debugging SMTP server can be setup using Python. + + python2 -m smtpd -n -c DebuggingServer localhost:1025 + +In local_settings.py change the EMAIL_HOST to 'localhost' and the EMAIL_PORT to +1025. + # Production Installation Ask someone who knows, or you are going to be in trouble. diff --git a/archweb.wsgi b/archweb.wsgi index 20ec463e..a5253131 100644 --- a/archweb.wsgi +++ b/archweb.wsgi @@ -14,26 +14,5 @@ os.environ['DJANGO_SETTINGS_MODULE'] = "settings" os.chdir(base_path) -using_newrelic = False -try: - key_path = os.path.join(base_path, "newrelic.key") - if os.path.exists(key_path): - with open(key_path) as keyfile: - key = keyfile.read().strip() - os.environ["NEW_RELIC_LICENSE_KEY"] = key - - import newrelic.agent - from newrelic.api.exceptions import ConfigurationError - try: - newrelic.agent.initialize(os.path.join(base_path, "newrelic.ini")) - using_newrelic = True - except ConfigurationError: - pass -except ImportError: - pass - from django.core.wsgi import get_wsgi_application application = get_wsgi_application() - -if using_newrelic: - application = newrelic.agent.wsgi_application()(application) diff --git a/devel/forms.py b/devel/forms.py index d953c614..0968acf4 100644 --- a/devel/forms.py +++ b/devel/forms.py @@ -60,7 +60,7 @@ class NewUserForm(forms.ModelForm): 'alias', 'public_email') for key in keys: self.fields[key] = old[key] - for key, val in old.items(): + for key, _ in old.items(): if key not in keys: self.fields[key] = old[key] diff --git a/devel/management/commands/pgp_import.py b/devel/management/commands/pgp_import.py index 7a124f77..8eb06d50 100644 --- a/devel/management/commands/pgp_import.py +++ b/devel/management/commands/pgp_import.py @@ -7,7 +7,7 @@ Import keys and signatures from a given GPG keyring. Usage: ./manage.py pgp_import <keyring_path> """ -from collections import namedtuple, OrderedDict +from collections import OrderedDict from datetime import datetime import logging from pytz import utc diff --git a/devel/management/commands/rematch_developers.py b/devel/management/commands/rematch_developers.py index bbb43df0..8636002a 100644 --- a/devel/management/commands/rematch_developers.py +++ b/devel/management/commands/rematch_developers.py @@ -59,7 +59,7 @@ def match_packager(finder): user = finder.find(packager) if user: mapping[packager] = user - logger.debug(" found user %s" % user.username) + logger.debug(" found user %s", user.username) matched_count += 1 for packager_str, user in mapping.items(): @@ -85,7 +85,7 @@ def match_flagrequest(finder): user = finder.find_by_email(user_email) if user: mapping[user_email] = user - logger.debug(" found user %s" % user.username) + logger.debug(" found user %s", user.username) matched_count += 1 for user_email, user in mapping.items(): diff --git a/devel/management/commands/reporead.py b/devel/management/commands/reporead.py index c97c2384..92d745bd 100644 --- a/devel/management/commands/reporead.py +++ b/devel/management/commands/reporead.py @@ -338,7 +338,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/devel/management/commands/reporead_inotify.py b/devel/management/commands/reporead_inotify.py index 1422ae26..fadcb881 100644 --- a/devel/management/commands/reporead_inotify.py +++ b/devel/management/commands/reporead_inotify.py @@ -35,6 +35,7 @@ logging.basicConfig( stream=sys.stderr) logger = logging.getLogger() + class Command(BaseCommand): help = "Watch database files and run an update when necessary." args = "[path_template]" @@ -73,16 +74,16 @@ class Command(BaseCommand): directories we need to watch for database updates. It then validates and passes these on to the various pyinotify pieces as necessary and finally builds and returns a notifier object.''' - transaction.commit_manually() - arches = Arch.objects.filter(agnostic=False) - repos = Repo.objects.all() - transaction.set_dirty() + with transaction.atomic(): + arches = Arch.objects.filter(agnostic=False) + repos = Repo.objects.all() + arch_path_map = {arch: None for arch in arches} all_paths = set() total_paths = 0 for arch in arches: - combos = ({ 'repo': repo.name.lower(), 'arch': arch.name } - for repo in repos) + combos = ({'repo': repo.name.lower(), 'arch': arch.name} + for repo in repos) # take a python format string and generate all unique combinations # of directories from it; using set() ensures we filter it down paths = {self.path_template % values for values in combos} @@ -97,7 +98,7 @@ class Command(BaseCommand): # template mapped to only one architecture if total_paths != len(all_paths): raise CommandError('path template did not uniquely ' - 'determine architecture for each file') + 'determine architecture for each file') # A proper atomic replacement of the database as done by rsync is type # IN_MOVED_TO. repo-add/remove will finish with a IN_CLOSE_WRITE. @@ -131,7 +132,7 @@ class Database(object): def _start_update_countdown(self): self.update_thread = threading.Timer(self.delay, self.update) logger.info('Starting %.1f second countdown to update %s', - self.delay, self.path) + self.delay, self.path) self.update_thread.start() def queue_for_update(self, mtime): diff --git a/devel/reports.py b/devel/reports.py index 66fbd627..b754b264 100644 --- a/devel/reports.py +++ b/devel/reports.py @@ -5,7 +5,7 @@ from django.db.models import F from django.template.defaultfilters import filesizeformat from django.utils.timezone import now -from .models import DeveloperKey, UserProfile +from .models import DeveloperKey from main.models import PackageFile from packages.models import PackageRelation, Depend @@ -21,19 +21,19 @@ class DeveloperReport(object): self.personal = personal -def old(packages, username): +def old(packages): cutoff = now() - timedelta(days=365 * 2) return packages.filter( build_date__lt=cutoff).order_by('build_date') -def outofdate(packages, username): +def outofdate(packages): cutoff = now() - timedelta(days=30) return packages.filter( flag_date__lt=cutoff).order_by('flag_date') -def big(packages, username): +def big(packages): cutoff = 50 * 1024 * 1024 packages = packages.filter( compressed_size__gte=cutoff).order_by('-compressed_size') @@ -46,7 +46,7 @@ def big(packages, username): return packages -def badcompression(packages, username): +def badcompression(packages): cutoff = 0.90 * F('installed_size') packages = packages.filter(compressed_size__gt=25*1024, installed_size__gt=25*1024, @@ -95,7 +95,7 @@ def uncompressed_info(packages, username): return packages.filter(id__in=set(bad_files)) -def unneeded_orphans(packages, username): +def unneeded_orphans(packages): owned = PackageRelation.objects.all().values('pkgbase') required = Depend.objects.all().values('name') # The two separate calls to exclude is required to do the right thing @@ -103,7 +103,7 @@ def unneeded_orphans(packages, username): pkgname__in=required) -def mismatched_signature(packages, username): +def mismatched_signature(packages): filtered = [] packages = packages.select_related( 'arch', 'repo', 'packager').filter(signature_bytes__isnull=False) @@ -127,7 +127,7 @@ def mismatched_signature(packages, username): return filtered -def signature_time(packages, username): +def signature_time(packages): cutoff = timedelta(hours=24) filtered = [] packages = packages.select_related( diff --git a/local_settings.py.example b/local_settings.py.example index 44e38459..5fb3c449 100644 --- a/local_settings.py.example +++ b/local_settings.py.example @@ -1,6 +1,5 @@ ## Debug settings DEBUG = False # If you are running without another HTTP server, must be true -TEMPLATE_DEBUG = False DEBUG_TOOLBAR = False # Must install package django-debug-toolbar to use ## 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/newrelic.ini b/newrelic.ini deleted file mode 100644 index 72158dc4..00000000 --- a/newrelic.ini +++ /dev/null @@ -1,212 +0,0 @@ -# --------------------------------------------------------------------------- - -# -# This file configures the New Relic Python Agent. -# -# The path to the configuration file should be supplied to the function -# newrelic.agent.initialize() when the agent is being initialized. -# -# The configuration file follows a structure similar to what you would -# find for Microsoft Windows INI files. For further information on the -# configuration file format see the Python ConfigParser documentation at: -# -# http://docs.python.org/library/configparser.html -# -# For further discussion on the behaviour of the Python agent that can -# be configured via this configuration file see: -# -# http://newrelic.com/docs/python/python-agent-configuration -# - -# --------------------------------------------------------------------------- - -# Here are the settings that are common to all environments. - -[newrelic] - -# You must specify the license key associated with your New -# Relic account. This key binds the Python Agent's data to your -# account in the New Relic service. -#license_key = -# NOTE: this is specified by NEW_RELIC_LICENSE_KEY environment variable -# so this file can live in version control. - -# The appplication name. Set this to be the name of your -# application as you would like it to show up in New Relic UI. -# The UI will then auto-map instances of your application into a -# entry on your home dashboard page. -app_name = Archweb - -# When "true", the agent collects performance data about your -# application and reports this data to the New Relic UI at -# newrelic.com. This global switch is normally overridden for -# each environment below. -monitor_mode = true - -# Sets the name of a file to log agent messages to. Useful for -# debugging any issues with the agent. This is not set by -# default as it is not known in advance what user your web -# application processes will run as and where they have -# permission to write to. Whatever you set this to you must -# ensure that the permissions for the containing directory and -# the file itself are correct, and that the user that your web -# application runs as can write to the file. If not able to -# write out a log file, it is also possible to say "stderr" and -# output to standard error output. This would normally result in -# output appearing in your web server log. -#log_file = /tmp/newrelic-python-agent.log - -# Sets the level of detail of messages sent to the log file, if -# a log file location has been provided. Possible values, in -# increasing order of detail, are: "critical", "error", "warning", -# "info" and "debug". When reporting any agent issues to New -# Relic technical support, the most useful setting for the -# support engineers is "debug". However, this can generate a lot -# of information very quickly, so it is best not to keep the -# agent at this level for longer than it takes to reproduce the -# problem you are experiencing. -log_level = info - -# The Python Agent communicates with the New Relic service using -# SSL by default. Note that this does result in an increase in -# CPU overhead, over and above what would occur for a non SSL -# connection, to perform the encryption involved in the SSL -# communication. This work is though done in a distinct thread -# to those handling your web requests, so it should not impact -# response times. You can if you wish revert to using a non SSL -# connection, but this will result in information being sent -# over a plain socket connection and will not be as secure. -ssl = true - -# High Security Mode enforces certain security settings, and -# prevents them from being overridden, so that no sensitive data -# is sent to New Relic. Enabling High Security Mode means that -# SSL is turned on, request parameters are not collected, and SQL -# can not be sent to New Relic in its raw form. To activate High -# Security Mode, it must be set to 'true' in this local .ini -# configuration file AND be set to 'true' in the server-side -# configuration in the New Relic user interface. For details, see -# https://docs.newrelic.com/docs/subscriptions/high-security -high_security = false - -# The Python Agent will attempt to connect directly to the New -# Relic service. If there is an intermediate firewall between -# your host and the New Relic service that requires you to use a -# HTTP proxy, then you should set both the "proxy_host" and -# "proxy_port" settings to the required values for the HTTP -# proxy. The "proxy_user" and "proxy_pass" settings should -# additionally be set if proxy authentication is implemented by -# the HTTP proxy. The "proxy_scheme" setting dictates what -# protocol scheme is used in talking to the HTTP proxy. This -# would normally always be set as "http" which will result in the -# agent then using a SSL tunnel through the HTTP proxy for end to -# end encryption. -# proxy_scheme = http -# proxy_host = hostname -# proxy_port = 8080 -# proxy_user = -# proxy_pass = - -# Tells the transaction tracer and error collector (when -# enabled) whether or not to capture the query string for the -# URL and send it as the request parameters for display in the -# UI. When "true", it is still possible to exclude specific -# values from being captured using the "ignored_params" setting. -capture_params = false - -# Space separated list of variables that should be removed from -# the query string captured for display as the request -# parameters in the UI. -ignored_params = - -# The transaction tracer captures deep information about slow -# transactions and sends this to the UI on a periodic basis. The -# transaction tracer is enabled by default. Set this to "false" -# to turn it off. -transaction_tracer.enabled = true - -# Threshold in seconds for when to collect a transaction trace. -# When the response time of a controller action exceeds this -# threshold, a transaction trace will be recorded and sent to -# the UI. Valid values are any positive float value, or (default) -# "apdex_f", which will use the threshold for a dissatisfying -# Apdex controller action - four times the Apdex T value. -transaction_tracer.transaction_threshold = apdex_f - -# When the transaction tracer is on, SQL statements can -# optionally be recorded. The recorder has three modes, "off" -# which sends no SQL, "raw" which sends the SQL statement in its -# original form, and "obfuscated", which strips out numeric and -# string literals. -transaction_tracer.record_sql = obfuscated - -# Threshold in seconds for when to collect stack trace for a SQL -# call. In other words, when SQL statements exceed this -# threshold, then capture and send to the UI the current stack -# trace. This is helpful for pinpointing where long SQL calls -# originate from in an application. -transaction_tracer.stack_trace_threshold = 0.5 - -# Determines whether the agent will capture query plans for slow -# SQL queries. Only supported in MySQL and PostgreSQL. Set this -# to "false" to turn it off. -transaction_tracer.explain_enabled = true - -# Threshold for query execution time below which query plans -# will not not be captured. Relevant only when "explain_enabled" -# is true. -transaction_tracer.explain_threshold = 0.5 - -# Space separated list of function or method names in form -# 'module:function' or 'module:class.function' for which -# additional function timing instrumentation will be added. -transaction_tracer.function_trace = - -# The error collector captures information about uncaught -# exceptions or logged exceptions and sends them to UI for -# viewing. The error collector is enabled by default. Set this -# to "false" to turn it off. -error_collector.enabled = true - -# To stop specific errors from reporting to the UI, set this to -# a space separated list of the Python exception type names to -# ignore. The exception name should be of the form 'module:class'. -error_collector.ignore_errors = - -# Browser monitoring is the Real User Monitoring feature of the UI. -# For those Python web frameworks that are supported, this -# setting enables the auto-insertion of the browser monitoring -# JavaScript fragments. -browser_monitoring.auto_instrument = false - -# A thread profiling session can be scheduled via the UI when -# this option is enabled. The thread profiler will periodically -# capture a snapshot of the call stack for each active thread in -# the application to construct a statistically representative -# call tree. -thread_profiler.enabled = true - -# --------------------------------------------------------------------------- - -# -# The application environments. These are specific settings which -# override the common environment settings. The settings related to a -# specific environment will be used when the environment argument to the -# newrelic.agent.initialize() function has been defined to be either -# "development", "test", "staging" or "production". -# - -[newrelic:development] -monitor_mode = false - -[newrelic:test] -monitor_mode = false - -[newrelic:staging] -app_name = Archweb (Staging) -monitor_mode = true - -[newrelic:production] -monitor_mode = true - -# --------------------------------------------------------------------------- diff --git a/news/migrations/0002_news_send_announce.py b/news/migrations/0002_news_send_announce.py new file mode 100644 index 00000000..62c23226 --- /dev/null +++ b/news/migrations/0002_news_send_announce.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('news', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='news', + name='send_announce', + field=models.BooleanField(default=True), + preserve_default=True, + ), + ] diff --git a/news/models.py b/news/models.py index a66da8d4..b413d17b 100644 --- a/news/models.py +++ b/news/models.py @@ -17,6 +17,7 @@ class News(models.Model): guid = models.CharField(max_length=255, editable=False) content = models.TextField() safe_mode = models.BooleanField(default=True) + send_announce = models.BooleanField(default=True) def get_absolute_url(self): return '/news/%s/' % self.slug diff --git a/news/views.py b/news/views.py index 274ba75d..f85db171 100644 --- a/news/views.py +++ b/news/views.py @@ -1,6 +1,8 @@ from django import forms +from django.core.mail import send_mail from django.http import HttpResponse from django.shortcuts import get_object_or_404, redirect +from django.template import Context, loader from django.views.decorators.http import require_POST from django.views.generic import (DetailView, ListView, CreateView, UpdateView, DeleteView) @@ -37,6 +39,16 @@ class NewsCreateView(CreateView): newsitem.author = self.request.user newsitem.slug = find_unique_slug(News, newsitem.title) newsitem.save() + if newsitem.send_announce: + ctx = Context({ + 'news': newsitem, + }) + template = loader.get_template('news/news_email_notification.txt') + send_mail('[arch-announce] %s' % newsitem.title, + template.render(ctx), + '"Arch Linux: Recent news updates: %s" <arch-announce@archlinux.org>' % newsitem.author.get_full_name(), + ['arch-announce@archlinux.org'], + fail_silently=True) return super(NewsCreateView, self).form_valid(form) diff --git a/releng/models.py b/releng/models.py index a4af81ab..9b7f8c90 100644 --- a/releng/models.py +++ b/releng/models.py @@ -139,11 +139,11 @@ class Release(models.Model): return "iso/%s/" % self.version def iso_url(self): - return "iso/%s/%s-%s-dual.iso" % (self.version, settings.BRANDING_SLUG, self.version) + return "iso/%s/%s-%s-x86_64.iso" % (self.version, settings.BRANDING_SLUG, self.version) def magnet_uri(self): query = [ - ('dn', "%s-%s-dual.iso" % (settings.BRANDING_SLUG, self.version)), + ('dn', "%s-%s-x86_64.iso" % (settings.BRANDING_SLUG, self.version)), ] if settings.TORRENT_TRACKERS: query.extend(('tr', uri) for uri in settings.TORRENT_TRACKERS) diff --git a/releng/views.py b/releng/views.py index 793249fc..54ae64f7 100644 --- a/releng/views.py +++ b/releng/views.py @@ -237,7 +237,7 @@ def release_torrent(request, version): data = b64decode(release.torrent_data.encode('utf-8')) response = HttpResponse(data, content_type='application/x-bittorrent') # TODO: this is duplicated from Release.iso_url() - filename = '%s-%s-dual.iso.torrent' % (settings.BRANDING_SLUG, release.version) + filename = '%s-%s-x86_64.iso.torrent' % (settings.BRANDING_SLUG, release.version) response['Content-Disposition'] = 'attachment; filename=%s' % filename return response 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 7571f0fc..e64e8620 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,28 +44,26 @@ 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', - 'main.context_processors.branding', -) - -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', + 'main.context_processors.branding', + ], + } + } +] MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', @@ -118,7 +115,6 @@ INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.staticfiles', 'django_countries', - 'django_jinja', 'main', 'mirrors', @@ -201,15 +197,21 @@ COUNTRIES_OVERRIDE = { 'US': 'United States', } +# Make this unique, and don't share it with anybody. +SECRET_KEY = '00000000000000000000000000000000000000000000000' + +DATABASES = { + 'default': { + 'ENGINE' : 'django.db.backends.sqlite3', + 'NAME' : 'database.db', + }, +} + ## Import local settings -from local_settings import * - -# Enable caching templates in production environments -if not TEMPLATE_DEBUG: - TEMPLATE_LOADERS = ( - ('django.template.loaders.cached.Loader', TEMPLATE_LOADERS), - ) - JINJA2_BYTECODE_CACHE_ENABLE = True +try: + from local_settings import * +except ImportError: + pass # Enable the debug toolbar if requested if DEBUG_TOOLBAR: 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 5fe1c585..597d1f85 100644 --- a/templates/mirrors/mirror_details.html +++ b/templates/mirrors/mirror_details.html @@ -94,10 +94,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 f11d57ca..250d9bad 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 96fcc49d..dd83a56c 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/news/news_email_notification.txt b/templates/news/news_email_notification.txt new file mode 100644 index 00000000..2588c921 --- /dev/null +++ b/templates/news/news_email_notification.txt @@ -0,0 +1,3 @@ +{{ news.content }} + +URL: https://www.archlinux.org{{ news.get_absolute_url }} diff --git a/templates/packages/details.html b/templates/packages/details.html index 82f2c604..aa737287 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 667a77cb..e2987e5f 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 f5b08805..9e4bd9df 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="{{ BRANDING_DISTRONAME }}"/> {% 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/public/download.html b/templates/public/download.html index ae8273c7..af3706a3 100644 --- a/templates/public/download.html +++ b/templates/public/download.html @@ -21,9 +21,9 @@ <h3>Release Info</h3> <p>The image can be burned to a CD, mounted as an ISO file, - or be directly written to a USB stick using a utility like `dd`. It + or be directly written to a USB stick using a utility like <code>dd<code>. It is intended for new installations only; an existing {{ BRANDING_DISTRONAME }} system - can always be updated with `pacman -Syu`.</p> + can always be updated with <code>pacman -Syu<code>.</p> <ul> {% if release.version %}<li><strong>Current Release:</strong> {{ release.version }}</li>{% endif %} diff --git a/templates/releng/archlinux.ipxe b/templates/releng/archlinux.ipxe index 3a7ba973..ae7b5195 100644 --- a/templates/releng/archlinux.ipxe +++ b/templates/releng/archlinux.ipxe @@ -9,7 +9,7 @@ imgtrust # initial options set release {{ releases.0 }} -set extrabootoptions ip=dhcp net.ifnames=0 +set extrabootoptions ip=dhcp net.ifnames=0 BOOTIF=01-${netX/mac} set countrycode :main diff --git a/templates/sitemaps/news_sitemap.xml.jinja b/templates/sitemaps/news_sitemap.xml index cbd86578..e9ef2bb2 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>{{ BRANDING_DISTRONAME }} 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 %} @@ -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'), ) |