Esempio n. 1
0
 def join(self, *comps):
     # This function is called a lot, so we optimize it; there are
     # unittests to check that we match _slow_but_correct_join(), above.
     path = ''
     sep = self.sep
     for comp in comps:
         if not comp:
             continue
         if comp[0] == sep:
             path = comp
             continue
         if path:
             path += sep
         path += comp
     if comps[-1] == '' and path:
         path += '/'
     path = path.replace(sep + sep, sep)
     return path
 def join(self, *comps):
     # This function is called a lot, so we optimize it; there are
     # unittests to check that we match _slow_but_correct_join(), above.
     path = ''
     sep = self.sep
     for comp in comps:
         if not comp:
             continue
         if comp[0] == sep:
             path = comp
             continue
         if path:
             path += sep
         path += comp
     if comps[-1] == '' and path:
         path += '/'
     path = path.replace(sep + sep, sep)
     return path
Esempio n. 3
0
 def http_test_path_to_uri(self, path):
     path = path.replace(os.sep, '/')
     return self.http_base_url(secure=self.is_secure_path(path)) + path