| 1 |
Index: /home/ismael/compilar/django_src/django/utils/feedgenerator.py |
|---|
| 2 |
=================================================================== |
|---|
| 3 |
--- /home/ismael/compilar/django_src/django/utils/feedgenerator.py (revision 797) |
|---|
| 4 |
+++ /home/ismael/compilar/django_src/django/utils/feedgenerator.py (working copy) |
|---|
| 5 |
@@ -17,7 +17,8 @@ |
|---|
| 6 |
For definitions of the different versions of RSS, see: |
|---|
| 7 |
http://diveintomark.org/archives/2004/02/04/incompatible-rss |
|---|
| 8 |
""" |
|---|
| 9 |
- |
|---|
| 10 |
+import email |
|---|
| 11 |
+import time |
|---|
| 12 |
from django.utils.xmlutils import SimplerXMLGenerator |
|---|
| 13 |
|
|---|
| 14 |
class SyndicationFeed: |
|---|
| 15 |
@@ -124,6 +125,9 @@ |
|---|
| 16 |
def writeRssElement(self, handler): |
|---|
| 17 |
handler.startElement(u"rss", {u"version": u"2.0"}) |
|---|
| 18 |
|
|---|
| 19 |
+ def rfc2822Date( self, date ): |
|---|
| 20 |
+ return email.Utils.formatdate( time.mktime( date.timetuple() ) ) |
|---|
| 21 |
+ |
|---|
| 22 |
def writeRssItem(self, handler, item): |
|---|
| 23 |
handler.startElement(u"item", {}) |
|---|
| 24 |
handler.addQuickElement(u"title", item['title'], {}) |
|---|
| 25 |
@@ -134,7 +138,7 @@ |
|---|
| 26 |
handler.addQuickElement(u"author", u"%s (%s)" % \ |
|---|
| 27 |
(item['author_email'], item['author_name']), {}) |
|---|
| 28 |
if item['pubdate'] is not None: |
|---|
| 29 |
- handler.addQuickElement(u"pubDate", item['pubdate'].strftime('%a, %d %b %Y %H:%M:%S %Z'), {}) |
|---|
| 30 |
+ handler.addQuickElement(u"pubDate", self.rfc2822Date(item['pubdate']), {}) |
|---|
| 31 |
if item['comments'] is not None: |
|---|
| 32 |
handler.addQuickElement(u"comments", item['comments'], {}) |
|---|
| 33 |
if item['unique_id'] is not None: |
|---|