diff options
author | Parabola <dev@list.parabolagnulinux.org> | 2011-12-05 01:29:30 +0000 |
---|---|---|
committer | Parabola <dev@list.parabolagnulinux.org> | 2011-12-05 01:29:30 +0000 |
commit | 420a9ea6ab7a912f2288b6f8e852ea2e19556ec9 (patch) | |
tree | b337b7e29cf8303d0b78b5cb165919ffc1a57c4a /sitemaps.py | |
parent | 9426870d705cdc8f18b860e00da909e0e812bef7 (diff) | |
parent | 183c4d9cefa95f46c3fa3a6936f837542426eac2 (diff) |
Merge branch 'master' of /srv/git/repositories/parabolaweb
Diffstat (limited to 'sitemaps.py')
-rw-r--r-- | sitemaps.py | 70 |
1 files changed, 65 insertions, 5 deletions
diff --git a/sitemaps.py b/sitemaps.py index e321fe85..958d1f44 100644 --- a/sitemaps.py +++ b/sitemaps.py @@ -1,15 +1,16 @@ from django.contrib.sitemaps import Sitemap +from django.core.urlresolvers import reverse + from main.models import Package from news.models import News -from packages.utils import get_group_info +from packages.utils import get_group_info, get_split_packages_info class PackagesSitemap(Sitemap): changefreq = "weekly" priority = "0.5" def items(self): - return Package.objects.select_related('arch', 'repo').all() - return Package.objects.all() + return Package.objects.normal() def lastmod(self, obj): return obj.last_update @@ -40,14 +41,73 @@ class PackageGroupsSitemap(Sitemap): return '/groups/%s/%s/' % (obj['arch'], obj['name']) +class SplitPackagesSitemap(Sitemap): + changefreq = "weekly" + priority = "0.3" + + def items(self): + return get_split_packages_info() + + def lastmod(self, obj): + return obj['last_update'] + + def location(self, obj): + return '/packages/%s/%s/%s/' % ( + obj['repo'].name.lower(), obj['arch'], obj['pkgbase']) + + class NewsSitemap(Sitemap): changefreq = "never" - priority = "0.7" + priority = "0.8" def items(self): return News.objects.all() def lastmod(self, obj): - return obj.postdate + return obj.last_modified + + +class BaseSitemap(Sitemap): + base_viewnames = ( + ('index', 1.0, 'hourly'), + ('packages-search', 0.8, 'hourly'), + ('page-keys', 0.8, 'weekly'), + ('news-list', 0.7, 'weekly'), + ('groups-list', 0.5, 'weekly'), + ('mirror-status', 0.4, 'hourly'), + 'page-about', + 'page-art', + 'page-svn', + 'page-devs', + 'page-tus', + 'page-fellows', + 'page-donate', + 'page-download', + 'feeds-list', + 'mirror-list', + 'mirrorlist', + 'packages-differences', + 'releng-test-overview', + 'visualize-index', + ) + + def items(self): + return self.base_viewnames + + def location(self, obj): + name = obj + if isinstance(obj, tuple): + name = obj[0] + return reverse(name) + + def priority(self, obj): + if isinstance(obj, tuple): + return obj[1] + return 0.7 + + def changefreq(self, obj): + if isinstance(obj, tuple): + return obj[2] + return 'monthly' # vim: set ts=4 sw=4 et: |