Anonymous avatar Anonymous committed 49f78b7

Make urlparser compatible with Python 2.4

Comments (0)

Files changed (1)

 
 def connect(url):
     parsed = urlparse.urlparse(url)
-    if parsed.scheme == 'http':
+    if parsed[0] == 'http':
         klass = httplib.HTTPConnection
-    elif parsed.scheme == 'https':
+    elif parsed[0] == 'https':
         klass = httplib.HTTPSConnection
     else:
-        raise RuntimeError("Unsupported Scheme: %r" % (parsed.scheme, ))
-    host = parsed.netloc
+        raise RuntimeError("Unsupported Scheme: %r" % (parsed[0], ))
+    host = parsed[1]
     port = None
     if ':' in host:
         host, port = host.split(':', 1)
     remote Actor.
     """
     parsed, conn = connect(url)
-    conn.request('PUT', parsed.path, code_string)
+    conn.request('PUT', parsed[2], code_string)
     resp = conn.getresponse()
     if resp.status == 202:
         return RemoteAddress(url)
               addr.call('test') could be written as addr.test()
               
         """
+        print "getattr addr:",self.actor_id,"method",method
         f = lambda message=None,timeout=None : self.call(method,message,timeout)
         return f
         
     def lookup(url):
         if url.startswith('http://') or url.startswith('https://'):
             parsed, conn = connect(url)
-            conn.request('HEAD', parsed.path)
+            conn.request('HEAD', parsed[2])
             resp = conn.getresponse()
             if resp.status != 404:
                 return RemoteAddress(url)
         parsed, conn = connect(self._address)
         ## TODO how to get the address of the local http server? This does not give fully
         ## qualified return addresses
-        conn.request('POST', parsed.path, json.dumps(message, default=handle_address))
+        conn.request('POST', parsed[2], json.dumps(message, default=handle_address))
         resp = conn.getresponse()
 
     def kill(self):
         parsed, conn = connect(self._address)
-        conn.request('DELETE', parsed.path)
+        conn.request('DELETE', parsed[2])
         resp = conn.getresponse()
 
     def wait(self):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.