summaryrefslogtreecommitdiff
path: root/community/flumotion/python27.patch
blob: 70b00bbebca3c667891ba7ec0dbda3b2699ab35c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Index: flumotion/twisted/reflect.py
===================================================================
--- flumotion/twisted/reflect.py	(revision 8894)
+++ flumotion/twisted/reflect.py	(working copy)
@@ -57,7 +57,10 @@
             # if the ImportError happened in the module being imported,
             # this is a failure that should be handed to our caller.
             shortname = trialname.split('.')[-1]
-            r = str(sys.exc_info()[1])
+            # if we're on python2.7 the module is wrapped in single quotation
+            # marks thus broking this method that relies on the message ending
+            # with the name that failed.
+            r = str(sys.exc_info()[1]).strip("'")
             if not (r.startswith('No module named') and
                     r.endswith(shortname)):
                 raise
@@ -71,3 +74,10 @@
         obj = getattr(obj, n)
 
     return obj
+
+# Use the method that comes with twisted if we're running on 8.0 or higher.
+# FIXME: Remove this module when we can depend on Twisted 8.0
+from twisted.copyright import version
+twistedVersion = tuple([int(n) for n in version.split('.')[0:3]])
+if twistedVersion >= (8, 0, 0):
+    from twisted.python.reflect import namedAny