~ubuntu-branches/ubuntu/gutsy/serpentine/gutsy

« back to all changes in this revision

Viewing changes to serpentine/urlutil.py

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-08-16 21:15:55 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070816211555-t0h0nugk2kn1tb61
Tags: 0.9-0ubuntu1
* New upstream version
* debian/control:
  - updated XS-Python-Version value

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
import urllib
23
23
 
24
 
from os import path
 
24
from os.path import abspath, join
 
25
from os.path import exists as path_exists
 
26
from os.path import basename as path_basename
25
27
from urlparse import urlparse, urlunparse
26
28
 
27
29
class _PropertyGen(object):
64
66
            # quoted path is actually not quoted
65
67
            self.make_writable()
66
68
            if basepath is None:
67
 
                unqpath = path.abspath(self.quoted_path)
 
69
                unqpath = abspath(self.quoted_path)
68
70
            else:
69
 
                unqpath = path.join(basepath, self.quoted_path)
 
71
                unqpath = join(basepath, self.quoted_path)
70
72
                
71
73
            self.quoted_path = urllib.quote(unqpath)
72
74
            self.scheme = "file"
97
99
        self.data = list(self.data)
98
100
    
99
101
    def exists(self):
100
 
        return not self.is_local or path.exists(self.path)
 
102
        return not self.is_local or path_exists(self.path)
101
103
    
102
104
    
103
105
def get_path(uri_or_path, basepath=None):
114
116
    return UrlParse(uri_or_path, basepath).is_local
115
117
 
116
118
def basename(uri_or_path, basepath=None):
117
 
    return path.basename(UrlParse(uri_or_path, basepath).path)
 
119
    return path_basename(UrlParse(uri_or_path, basepath).path)
118
120
 
119
121
def exists(uri_or_path, basepath=None):
120
122
    return UrlParse(uri_or_path, basepath).exists()