diff options
Diffstat (limited to 'app/builder/base.py')
-rw-r--r-- | app/builder/base.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/builder/base.py b/app/builder/base.py index 0d2cb0f..839c522 100644 --- a/app/builder/base.py +++ b/app/builder/base.py @@ -1,4 +1,6 @@ import os +from operator import attrgetter +from itertools import chain from math import ceil from decimal import Decimal from django.test.client import Client @@ -150,3 +152,18 @@ class BuildPages(BuildNew): fpath = '%s' %(page.slug) self.write_file('', t, 'html', page.slug) self.write_file('', t, 'txt', page.slug) + + +class BuildRSS(BuildNew): + def build(self): + entry_list = apps.get_model('blog', 'entry').objects.filter(status=1) + link_list = apps.get_model('links', 'link').objects.filter(status=1) + result_list = sorted( + chain(entry_list, link_list), + key=attrgetter('pub_date') + ) + qs = reversed(result_list) + c = {'object_list': qs, 'SITE_URL': settings.SITE_URL} + t = render_to_string('feed.xml', c).encode('utf-8') + fpath = '%s' % ('rss/',) + self.write_file(fpath, t, 'xml') |