[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
This commit is contained in:
parent
a9879b1438
commit
9f78e4692c
|
@ -52,10 +52,16 @@ def get_tag_uri(url, date):
|
||||||
See http://diveintomark.org/archives/2004/05/28/howto-atom-id
|
See http://diveintomark.org/archives/2004/05/28/howto-atom-id
|
||||||
"""
|
"""
|
||||||
url_split = urlparse.urlparse(url)
|
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 = ''
|
d = ''
|
||||||
if date is not None:
|
if date is not None:
|
||||||
d = ',%s' % date.strftime('%Y-%m-%d')
|
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):
|
class SyndicationFeed(object):
|
||||||
"Base class for all syndication feeds. Subclasses should provide write()"
|
"Base class for all syndication feeds. Subclasses should provide write()"
|
||||||
|
|
Loading…
Reference in New Issue