summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2010-02-14 20:33:32 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2010-02-14 20:33:32 +0000
commit9f78e4692c6d119226cce34f2cb7c549e40862b2 (patch)
tree96a88d1b6fee631211e91ea543c33483796c58f7
parenta9879b14387f4ee8439b4fc53ef55602b6a48db2 (diff)
[1.1.X] Fixed a couple Python 2.4 incompatibilities. Backport of [12434].
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.1.X@12435 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/utils/feedgenerator.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/django/utils/feedgenerator.py b/django/utils/feedgenerator.py
index 7e5a4a0ae3..eb2e5c00da 100644
--- a/django/utils/feedgenerator.py
+++ b/django/utils/feedgenerator.py
@@ -52,10 +52,16 @@ 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]
+
d = ''
if date is not None:
d = ',%s' % date.strftime('%Y-%m-%d')
- return u'tag:%s%s:%s/%s' % (url_split.hostname, d, url_split.path, url_split.fragment)
+ return u'tag:%s%s:%s/%s' % (hostname, d, path, fragment)
class SyndicationFeed(object):
"Base class for all syndication feeds. Subclasses should provide write()"