Ticket #8758: 8758_feedgenerator.diff

File 8758_feedgenerator.diff, 1.7 KB (added by Arthur Koziel, 16 years ago)
  • django/utils/feedgenerator.py

    diff --git a/django/utils/feedgenerator.py b/django/utils/feedgenerator.py
    index de924a3..724b74d 100644
    a b http://diveintomark.org/archives/2004/02/04/incompatible-rss  
    2121
    2222import re
    2323import datetime
     24from urlparse import urlparse
    2425from django.utils.xmlutils import SimplerXMLGenerator
    2526from django.utils.encoding import force_unicode, iri_to_uri
    2627
    def rfc3339_date(date):  
    4748
    4849def get_tag_uri(url, date):
    4950    "Creates a TagURI. See http://diveintomark.org/archives/2004/05/28/howto-atom-id"
    50     tag = re.sub('^http://', '', url)
    51     if date is not None:
    52         tag = re.sub('/', ',%s:/' % date.strftime('%Y-%m-%d'), tag, 1)
    53     tag = re.sub('#', '/', tag)
    54     return u'tag:' + tag
     51    url_split = urlparse(url)
     52    tagging_entity = "%s,%s:" % (url_split.hostname, date.strftime('%Y-%m-%d'))
     53    return u'tag:%s%s/%s' % (tagging_entity, url_split.path, url_split.fragment)
    5554
    5655class SyndicationFeed(object):
    5756    "Base class for all syndication feeds. Subclasses should provide write()"
  • tests/regressiontests/utils/tests.py

    diff --git a/tests/regressiontests/utils/tests.py b/tests/regressiontests/utils/tests.py
    index 485c5fa..b38888c 100644
    a b from django.utils import html, checksums  
    99import timesince
    1010import datastructures
    1111import itercompat
     12import feedgenerator
    1213from decorators import DecoratorFromMiddlewareTests
    1314
    1415# We need this because "datastructures" uses sorted() and the tests are run in
    __test__ = {  
    2324    'timesince': timesince,
    2425    'datastructures': datastructures,
    2526    'itercompat': itercompat,
     27    'feedgenerator': feedgenerator,
    2628}
    2729
    2830class TestUtilsHtml(TestCase):
Back to Top