def testUrlToString(self): url = atom.url.Url(port=80) url.host = 'example.com' self.assertTrue(str(url), '//example.com:80') url = atom.url.Url(protocol='http', host='example.com', path='/feed') url.params['has spaces'] = 'sneaky=values?&!' self.assertTrue(url.to_string() == ( 'http://example.com/feed?has+spaces=sneaky%3Dvalues%3F%26%21'))
def testUrlToString(self): url = atom.url.Url(port=80) url.host = 'example.com' self.assert_(str(url), '//example.com:80') url = atom.url.Url(protocol='http', host='example.com', path='/feed') url.params['has spaces'] = 'sneaky=values?&!' self.assert_(url.to_string() == ( 'http://example.com/feed?has+spaces=sneaky%3Dvalues%3F%26%21'))
def _get_access_url(self, url): proxy = os.environ.get('http_proxy') if url.protocol == 'http' and proxy: return url.to_string() else: return url.get_request_uri()
def _get_access_url(self, url): return url.to_string()