summaryrefslogtreecommitdiff
path: root/sitemaps.py
diff options
context:
space:
mode:
Diffstat (limited to 'sitemaps.py')
-rw-r--r--sitemaps.py53
1 files changed, 44 insertions, 9 deletions
diff --git a/sitemaps.py b/sitemaps.py
index 424168bf..d206a1b6 100644
--- a/sitemaps.py
+++ b/sitemaps.py
@@ -7,17 +7,31 @@ from django.core.urlresolvers import reverse
from main.models import Package
from news.models import News
from packages.utils import get_group_info, get_split_packages_info
+from releng.models import Release
-class PackagesSitemap(Sitemap):
- changefreq = "weekly"
- priority = "0.5"
+class PackagesSitemap(Sitemap):
def items(self):
- return Package.objects.all().order_by()
+ return Package.objects.normal().only(
+ 'pkgname', 'last_update', 'files_last_update',
+ 'repo__name', 'repo__testing', 'repo__staging',
+ 'arch__name').order_by()
def lastmod(self, obj):
return obj.last_update
+ def changefreq(self, obj):
+ if obj.repo.testing or obj.repo.staging:
+ return "daily"
+ return "weekly"
+
+ def priority(self, obj):
+ if obj.repo.testing:
+ return "0.4"
+ if obj.repo.staging:
+ return "0.1"
+ return "0.5"
+
class PackageFilesSitemap(PackagesSitemap):
changefreq = "weekly"
@@ -60,19 +74,22 @@ class SplitPackagesSitemap(Sitemap):
class NewsSitemap(Sitemap):
- priority = "0.8"
-
def __init__(self):
now = datetime.utcnow().replace(tzinfo=utc)
self.one_day_ago = now - timedelta(days=1)
self.one_week_ago = now - timedelta(days=7)
def items(self):
- return News.objects.all().order_by()
+ return News.objects.all().defer('content', 'guid', 'title').order_by()
def lastmod(self, obj):
return obj.last_modified
+ def priority(self, obj):
+ if obj.last_modified > self.one_week_ago:
+ return "0.9"
+ return "0.8"
+
def changefreq(self, obj):
if obj.last_modified > self.one_day_ago:
return 'daily'
@@ -81,10 +98,28 @@ class NewsSitemap(Sitemap):
return 'yearly'
+class ReleasesSitemap(Sitemap):
+ changefreq = "monthly"
+
+ def items(self):
+ return Release.objects.all().defer('info', 'torrent_data').order_by()
+
+ def lastmod(self, obj):
+ return obj.created
+
+ def priority(self, obj):
+ if obj.available:
+ return "0.6"
+ return "0.2"
+
+
class BaseSitemap(Sitemap):
+ DEFAULT_PRIORITY = 0.7
+
base_viewnames = (
('index', 1.0, 'hourly'),
('packages-search', 0.8, 'hourly'),
+ ('page-download', 0.8, 'monthly'),
('page-keys', 0.8, 'weekly'),
('news-list', 0.7, 'weekly'),
('groups-list', 0.5, 'weekly'),
@@ -96,9 +131,9 @@ class BaseSitemap(Sitemap):
'page-tus',
'page-fellows',
'page-donate',
- 'page-download',
'feeds-list',
'mirror-list',
+ 'mirror-status',
'mirrorlist',
'packages-differences',
'releng-test-overview',
@@ -117,7 +152,7 @@ class BaseSitemap(Sitemap):
def priority(self, obj):
if isinstance(obj, tuple):
return obj[1]
- return 0.7
+ return self.DEFAULT_PRIORITY
def changefreq(self, obj):
if isinstance(obj, tuple):