summaryrefslogtreecommitdiff
path: root/django/utils
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2012-03-30 09:20:04 +0000
committerAymeric Augustin <aymeric.augustin@m4x.org>2012-03-30 09:20:04 +0000
commit4fe87c370dc7c282212c63c0502de13f411da79a (patch)
tree7af3fd8a2ec8ad71be5f37c1371828ab8f0fb352 /django/utils
parenteb163f37cb62268443d592f8ce08bd8a0ab9631d (diff)
Removed some Python < 2.6 compatibility code. Refs #17965.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17830 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils')
-rw-r--r--django/utils/http.py23
1 files changed, 6 insertions, 17 deletions
diff --git a/django/utils/http.py b/django/utils/http.py
index d343a375c0..dbd18d8ff0 100644
--- a/django/utils/http.py
+++ b/django/utils/http.py
@@ -207,20 +207,9 @@ def quote_etag(etag):
"""
return '"%s"' % etag.replace('\\', '\\\\').replace('"', '\\"')
-if sys.version_info >= (2, 6):
- def same_origin(url1, url2):
- """
- Checks if two URLs are 'same-origin'
- """
- p1, p2 = urlparse.urlparse(url1), urlparse.urlparse(url2)
- return (p1.scheme, p1.hostname, p1.port) == (p2.scheme, p2.hostname, p2.port)
-else:
- # Python 2.5 compatibility. This actually works for Python 2.6 and above,
- # but the above definition is much more obviously correct and so is
- # preferred going forward.
- def same_origin(url1, url2):
- """
- Checks if two URLs are 'same-origin'
- """
- p1, p2 = urlparse.urlparse(url1), urlparse.urlparse(url2)
- return p1[0:2] == p2[0:2]
+def same_origin(url1, url2):
+ """
+ Checks if two URLs are 'same-origin'
+ """
+ p1, p2 = urlparse.urlparse(url1), urlparse.urlparse(url2)
+ return (p1.scheme, p1.hostname, p1.port) == (p2.scheme, p2.hostname, p2.port)