summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--feeds.py66
-rw-r--r--releng/admin.py1
-rw-r--r--releng/migrations/0002_release_last_modified.py22
-rw-r--r--releng/migrations/0003_release_populate_last_modified.py21
-rw-r--r--releng/models.py1
-rw-r--r--requirements.txt2
-rw-r--r--requirements_prod.txt2
-rw-r--r--templates/public/index.html23
8 files changed, 80 insertions, 58 deletions
diff --git a/feeds.py b/feeds.py
index a7b7120c..be0e8dbb 100644
--- a/feeds.py
+++ b/feeds.py
@@ -1,5 +1,4 @@
from datetime import datetime, time
-import hashlib
from pytz import utc
from django.conf import settings
@@ -16,42 +15,23 @@ from releng.models import Release
class BatchWritesWrapper(object):
- def __init__(self, outfile, chunks=20):
+ def __init__(self, outfile):
self.outfile = outfile
- self.chunks = chunks
self.buf = []
+
def write(self, s):
buf = self.buf
buf.append(s)
- if len(buf) >= self.chunks:
+ if len(buf) >= 40:
self.outfile.write(''.join(buf))
self.buf = []
+
def flush(self):
self.outfile.write(''.join(self.buf))
self.outfile.flush()
-class GuidNotPermalinkFeed(Rss201rev2Feed):
- @staticmethod
- def check_for_unique_id(f):
- def wrapper(name, contents=None, attrs=None):
- if attrs is None:
- attrs = {}
- if name == 'guid':
- attrs['isPermaLink'] = 'false'
- return f(name, contents, attrs)
- return wrapper
-
- def write_items(self, handler):
- '''
- Totally disgusting. Monkey-patch the handler so if it sees a
- 'unique-id' field come through, add an isPermalink="false" attribute.
- Workaround for http://code.djangoproject.com/ticket/9800
- '''
- handler.addQuickElement = self.check_for_unique_id(
- handler.addQuickElement)
- super(GuidNotPermalinkFeed, self).write_items(handler)
-
+class FasterRssFeed(Rss201rev2Feed):
def write(self, outfile, encoding):
'''
Batch the underlying 'write' calls on the outfile because Python's
@@ -60,16 +40,10 @@ class GuidNotPermalinkFeed(Rss201rev2Feed):
'>' closing tags and over 1600 write calls in our package feed.
'''
wrapper = BatchWritesWrapper(outfile)
- super(GuidNotPermalinkFeed, self).write(wrapper, encoding)
+ super(FasterRssFeed, self).write(wrapper, encoding)
wrapper.flush()
-def package_etag(request, *args, **kwargs):
- latest = package_last_modified(request)
- if latest:
- return hashlib.md5(str(kwargs) + str(latest)).hexdigest()
- return None
-
def package_last_modified(request, *args, **kwargs):
cursor = connection.cursor()
cursor.execute("SELECT MAX(last_update) FROM packages")
@@ -77,12 +51,12 @@ def package_last_modified(request, *args, **kwargs):
class PackageFeed(Feed):
- feed_type = GuidNotPermalinkFeed
+ feed_type = FasterRssFeed
link = '/packages/'
def __call__(self, request, *args, **kwargs):
- wrapper = condition(etag_func=package_etag, last_modified_func=package_last_modified)
+ wrapper = condition(last_modified_func=package_last_modified)
return wrapper(super(PackageFeed, self).__call__)(request, *args, **kwargs)
__name__ = 'package_feed'
@@ -132,6 +106,8 @@ class PackageFeed(Feed):
def items(self, obj):
return obj['qs']
+ item_guid_is_permalink = False
+
def item_guid(self, item):
# http://diveintomark.org/archives/2004/05/28/howto-atom-id
date = item.last_update
@@ -152,12 +128,6 @@ class PackageFeed(Feed):
return (item.repo.name, item.arch.name)
-def news_etag(request, *args, **kwargs):
- latest = news_last_modified(request)
- if latest:
- return hashlib.md5(str(latest)).hexdigest()
- return None
-
def news_last_modified(request, *args, **kwargs):
cursor = connection.cursor()
cursor.execute("SELECT MAX(last_modified) FROM news")
@@ -165,7 +135,7 @@ def news_last_modified(request, *args, **kwargs):
class NewsFeed(Feed):
- feed_type = GuidNotPermalinkFeed
+ feed_type = FasterRssFeed
title = settings.BRANDING_DISTRONAME+': Recent news updates'
link = '/news/'
@@ -173,7 +143,7 @@ class NewsFeed(Feed):
subtitle = description
def __call__(self, request, *args, **kwargs):
- wrapper = condition(etag_func=news_etag, last_modified_func=news_last_modified)
+ wrapper = condition(last_modified_func=news_last_modified)
return wrapper(super(NewsFeed, self).__call__)(request, *args, **kwargs)
__name__ = 'news_feed'
@@ -182,12 +152,17 @@ class NewsFeed(Feed):
return News.objects.select_related('author').order_by(
'-postdate', '-id')[:10]
+ item_guid_is_permalink = False
+
def item_guid(self, item):
return item.guid
def item_pubdate(self, item):
return item.postdate
+ def item_updateddate(self, item):
+ return item.last_modified
+
def item_author_name(self, item):
return item.author.get_full_name()
@@ -199,7 +174,7 @@ class NewsFeed(Feed):
class ReleaseFeed(Feed):
- feed_type = GuidNotPermalinkFeed
+ feed_type = FasterRssFeed
title = settings.BRANDING_DISTRONAME+': Releases'
link = '/download/'
@@ -220,6 +195,11 @@ class ReleaseFeed(Feed):
def item_pubdate(self, item):
return datetime.combine(item.release_date, time()).replace(tzinfo=utc)
+ def item_updateddate(self, item):
+ return item.last_modified
+
+ item_guid_is_permalink = False
+
def item_guid(self, item):
# http://diveintomark.org/archives/2004/05/28/howto-atom-id
date = item.release_date
diff --git a/releng/admin.py b/releng/admin.py
index c7e6396e..9c93c4be 100644
--- a/releng/admin.py
+++ b/releng/admin.py
@@ -18,6 +18,7 @@ class ReleaseAdmin(admin.ModelAdmin):
list_display = ('version', 'release_date', 'kernel_version', 'available',
'created')
list_filter = ('available', 'release_date')
+ readonly_fields = ('created', 'last_modified')
SIMPLE_MODELS = (Architecture, BootType, Bootloader, ClockChoice, Filesystem,
diff --git a/releng/migrations/0002_release_last_modified.py b/releng/migrations/0002_release_last_modified.py
new file mode 100644
index 00000000..58502452
--- /dev/null
+++ b/releng/migrations/0002_release_last_modified.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import datetime
+from django.utils.timezone import utc
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('releng', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='release',
+ name='last_modified',
+ field=models.DateTimeField(default=datetime.datetime(2001, 1, 1, tzinfo=utc), editable=False),
+ preserve_default=False,
+ ),
+ ]
diff --git a/releng/migrations/0003_release_populate_last_modified.py b/releng/migrations/0003_release_populate_last_modified.py
new file mode 100644
index 00000000..ec7b6fda
--- /dev/null
+++ b/releng/migrations/0003_release_populate_last_modified.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+def forwards(apps, schema_editor):
+ Release = apps.get_model('releng', 'Release')
+ Release.objects.update(last_modified=models.F('created'))
+
+def backwards(apps, schema_editor):
+ pass
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('releng', '0002_release_last_modified'),
+ ]
+
+ operations = [
+ migrations.RunPython(forwards, backwards)
+ ]
diff --git a/releng/models.py b/releng/models.py
index 66690e81..2f9216bd 100644
--- a/releng/models.py
+++ b/releng/models.py
@@ -120,6 +120,7 @@ class Release(models.Model):
md5_sum = models.CharField('MD5 digest', max_length=32, blank=True)
sha1_sum = models.CharField('SHA1 digest', max_length=40, blank=True)
created = models.DateTimeField(editable=False)
+ last_modified = models.DateTimeField(editable=False)
available = models.BooleanField(default=True)
info = models.TextField('Public information', blank=True)
torrent_data = models.TextField(blank=True,
diff --git a/requirements.txt b/requirements.txt
index 4b111f06..e1acd2e9 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -5,7 +5,7 @@ Jinja2==2.7.3
Markdown==2.4.1
bencode==1.0
django-jinja==1.0.4
-django_countries==3.0
+django_countries==3.0.1
jsmin==2.0.11
pgpdump==1.5
pytz>=2014.7
diff --git a/requirements_prod.txt b/requirements_prod.txt
index 4f52ce3e..ef535eb8 100644
--- a/requirements_prod.txt
+++ b/requirements_prod.txt
@@ -5,7 +5,7 @@ Jinja2==2.7.3
Markdown==2.4.1
bencode==1.0
django-jinja==1.0.4
-django_countries==3.0
+django_countries==3.0.1
jsmin==2.0.11
pgpdump==1.5
psycopg2==2.5.4
diff --git a/templates/public/index.html b/templates/public/index.html
index a6ff7e9f..14b93427 100644
--- a/templates/public/index.html
+++ b/templates/public/index.html
@@ -109,7 +109,6 @@
{% cache 115 main-page-right secure %}
<div id="nav-sidebar" class="widget">
<h4>Documentation</h4>
-
<ul>
<li><a href="{% wiki_url %}"
title="Community documentation">Wiki</a></li>
@@ -120,7 +119,6 @@
</ul>
<h4>Community</h4>
-
<ul>
<li><a href="{{ MAILMAN_BASE_URL }}/mailman/listinfo/"
title="Community and developer mailing lists">Mailing Lists</a></li>
@@ -133,7 +131,6 @@
</ul>
<h4>Support</h4>
-
<ul>
<li><a href="{% url 'page-donate' %}"
title="Help support {{ BRANDING_DISTRONAME }}">Donate</a></li>
@@ -146,7 +143,6 @@
</ul>
<h4>Tools</h4>
-
<ul>
<li><a href="{% url 'mirrorlist' %}"
title="Get a custom mirrorlist from our database">Mirrorlist Updater</a></li>
@@ -154,12 +150,9 @@
title="See a listing of all available mirrors">Mirror List</a></li>
<li><a href="{% url 'mirror-status' %}"
title="Check the status of all known mirrors">Mirror Status</a></li>
- <li><a href="{% url 'packages-differences' %}"
- title="See differences in packages between available architectures">Differences Reports</a></li>
</ul>
<h4>Development</h4>
-
<ul>
<li><a href="{{ PROJECTS_URL }}"
title="Official {{BRANDING_SHORTNAME}} projects (git)">Projects in Git</a></li>
@@ -175,23 +168,27 @@
title="Release Engineering ISO listing">ISO Release List</a></li>
<li><a href="{% url 'visualize-index' %}"
title="View visualizations">Visualizations</a></li>
+ <li><a href="{% url 'packages-differences' %}"
+ title="See differences in packages between available architectures">Differences Reports</a></li>
</ul>
- <h4>More Resources</h4>
-
+ <h4>People</h4>
<ul>
+ <li><a href="{% url 'page-devs' %}" title="Active developers">Developers</a></li>
+ <li><a href="{% url 'page-tus' %}" title="Active Trusted Users (TUs)">Trusted Users</a></li>
+ <li><a href="{% url 'page-fellows' %}" title="Retired Developers">Fellows</a></li>
<li><a href="{% url 'page-keys' %}"
title="Package/Database signing master keys">Signing Master Keys</a></li>
+ </ul>
+
+ <h4>More Resources</h4>
+ <ul>
<li><a href="{% wiki_url 'Arch_Linux_press_coverage %}"
title="{{ BRANDING_DISTRONAME }} in the media">Press Coverage</a></li>
<li><a href="{% url 'page-art' %}" title="{{ BRANDING_SHORTNAME }} logos and other artwork for promotional use">Logos &amp; Artwork</a></li>
<li><a href="{% url 'news-list' %}" title="News Archives">News Archives</a></li>
<li><a href="/feeds/" title="Various RSS Feeds">RSS Feeds</a></li>
- <li><a href="{% url 'page-devs' %}" title="Active developers">Developer Profiles</a></li>
- <li><a href="{% url 'page-tus' %}" title="Active Trusted Users (TUs)">Trusted User Profiles</a></li>
- <li><a href="{% url 'page-fellows' %}" title="Retired Developers">Fellows Profiles</a></li>
</ul>
-
</div>
<div id="home-donate-button" class="widget">