[kupfer] core: Fix urlparse usage for Python 2.7.3



commit 6934a73c09e9bb2f82230a0a82fb6c516699d1f3
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date:   Thu Jun 28 20:35:46 2012 +0200

    core: Fix urlparse usage for Python 2.7.3
    
    Python 2.7.3 drops urlparse.uses_fragment global that we monkeypatched.
    In hindsight, it never was really necessary. uses_netloc which we still
    use is tricker to fix.
    
    This lets Kupfer work with 2.7.3 again.
    
    Co-authored-by: Karol BÄdkowski
    
    Launchpad-bug: https://bugs.launchpad.net/kupfer/+bug/1014502/

 kupfer/core/qfurl.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/core/qfurl.py b/kupfer/core/qfurl.py
index 90bbacc..76503ac 100644
--- a/kupfer/core/qfurl.py
+++ b/kupfer/core/qfurl.py
@@ -8,7 +8,11 @@ QFURL_SCHEME = "qpfer"
 
 # One would hope that there was a better way to do this
 urlparse.uses_netloc.append(QFURL_SCHEME)
-urlparse.uses_fragment.append(QFURL_SCHEME)
+try:
+	urlparse.uses_fragment.append(QFURL_SCHEME)
+except AttributeError:
+	# Python 2.7.3 drops `uses_fragment` global
+	pass
 
 class QfurlError (Exception):
 	pass



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]