Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed a couple Python 2.4 incompatibilities.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@12434 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 76afc30229812547f0624fc681710a877fe0fde8 1 parent db0209e
Jacob Kaplan-Moss authored February 14, 2010
8  django/utils/feedgenerator.py
@@ -52,10 +52,16 @@ def get_tag_uri(url, date):
52 52
     See http://diveintomark.org/archives/2004/05/28/howto-atom-id
53 53
     """
54 54
     url_split = urlparse.urlparse(url)
  55
+
  56
+    # Python 2.4 didn't have named attributes on split results or the hostname.
  57
+    hostname = getattr(url_split, 'hostname', url_split[1].split(':')[0])
  58
+    path = url_split[2]
  59
+    fragment = url_split[5]
  60
+
55 61
     d = ''
56 62
     if date is not None:
57 63
         d = ',%s' % date.strftime('%Y-%m-%d')
58  
-    return u'tag:%s%s:%s/%s' % (url_split.hostname, d, url_split.path, url_split.fragment)
  64
+    return u'tag:%s%s:%s/%s' % (hostname, d, path, fragment)
59 65
 
60 66
 class SyndicationFeed(object):
61 67
     "Base class for all syndication feeds. Subclasses should provide write()"
4  tests/regressiontests/test_client_regress/models.py
@@ -606,7 +606,7 @@ def test_single_context(self):
606 606
             response.context['does-not-exist']
607 607
             self.fail('Should not be able to retrieve non-existent key')
608 608
         except KeyError, e:
609  
-            self.assertEquals(e.message, 'does-not-exist')
  609
+            self.assertEquals(e.args[0], 'does-not-exist')
610 610
 
611 611
     def test_inherited_context(self):
612 612
         "Context variables can be retrieved from a list of contexts"
@@ -621,7 +621,7 @@ def test_inherited_context(self):
621 621
             response.context['does-not-exist']
622 622
             self.fail('Should not be able to retrieve non-existent key')
623 623
         except KeyError, e:
624  
-            self.assertEquals(e.message, 'does-not-exist')
  624
+            self.assertEquals(e.args[0], 'does-not-exist')
625 625
 
626 626
 
627 627
 class SessionTests(TestCase):

0 notes on commit 76afc30

Please sign in to comment.
Something went wrong with that request. Please try again.