summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2011-03-28 02:25:26 +0000
committerAdrian Holovaty <adrian@holovaty.com>2011-03-28 02:25:26 +0000
commit7cac1ecbd0f88825564f1e28901559c1b0aecb1a (patch)
tree10cc2a74de134bd12ca415de534f91a82427989e
parent3d5a8f758a6af8bdbcfad94dc7534cd3c1385d46 (diff)
Simplified django.utils.feedgenerator.get_tag_uri now that we don't require Python 2.4
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15930 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/utils/feedgenerator.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/django/utils/feedgenerator.py b/django/utils/feedgenerator.py
index a49e16be5c..e23fde71ae 100644
--- a/django/utils/feedgenerator.py
+++ b/django/utils/feedgenerator.py
@@ -66,17 +66,11 @@ def get_tag_uri(url, date):
See http://diveintomark.org/archives/2004/05/28/howto-atom-id
"""
- url_split = urlparse.urlparse(url)
-
- # Python 2.4 didn't have named attributes on split results or the hostname.
- hostname = getattr(url_split, 'hostname', url_split[1].split(':')[0])
- path = url_split[2]
- fragment = url_split[5]
-
+ bits = urlparse.urlparse(url)
d = ''
if date is not None:
d = ',%s' % datetime_safe.new_datetime(date).strftime('%Y-%m-%d')
- return u'tag:%s%s:%s/%s' % (hostname, d, path, fragment)
+ return u'tag:%s%s:%s/%s' % (bits.hostname, d, bits.path, bits.fragment)
class SyndicationFeed(object):
"Base class for all syndication feeds. Subclasses should provide write()"