diff options
author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2010-02-14 20:29:42 +0000 |
---|---|---|
committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2010-02-14 20:29:42 +0000 |
commit | 76afc30229812547f0624fc681710a877fe0fde8 (patch) | |
tree | 22defb962f51e96d238937fef3281dd373445ada /django/utils/feedgenerator.py | |
parent | db0209e2b215052f13737249462b644ee85f0249 (diff) | |
download | django-76afc30229812547f0624fc681710a877fe0fde8.tar.gz |
Fixed a couple Python 2.4 incompatibilities.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12434 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils/feedgenerator.py')
-rw-r--r-- | django/utils/feedgenerator.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/django/utils/feedgenerator.py b/django/utils/feedgenerator.py index 06008d36e8..856c164d81 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()" |