• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(415)  |  Call(372)  |  Derive(0)  |  Import(43)
OS-specific conversion from a file system path to a relative URL
of the 'file' scheme; not recommended for general use.

            def pathname2url(pathname):
        """OS-specific conversion from a file system path to a relative URL
        of the 'file' scheme; not recommended for general use."""
        return quote(pathname)
        


src/d/j/django-navbar-0.3.0/examples/dbgp/client.py   django-navbar(Download)
        import nturl2path
        return 'file:' + nturl2path.pathname2url( os.path.abspath( pathname ) )        
    else:
        return 'file:' + urllib.pathname2url( os.path.abspath( pathname ) )
 
# Only used by jython
def findOpenPort(start, retries):

src/s/a/sage-HEAD/trunk/local/lib/python2.4/site-packages/ZConfig/loader.py   sage(Download)
    def normalizeURL(self, url):
        if self.isPath(url):
            url = "file://" + urllib.pathname2url(os.path.abspath(url))
        newurl, fragment = ZConfig.url.urldefrag(url)
        if fragment:
            raise ZConfig.ConfigurationError(
                "fragment identifiers are not supported",
def _url_from_file(file):
    name = getattr(file, "name", None)
    if name and name[0] != "<" and name[-1] != ">":
        return "file://" + urllib.pathname2url(os.path.abspath(name))
    else:
        return None
 
            dirname = os.path.abspath(dir)
            fn = os.path.join(dirname, file)
            if os.path.exists(fn):
                return "file://" + urllib.pathname2url(fn)
        else:
            raise ZConfig.SchemaResourceError("schema component not found",
                                              filename=file,

src/s/a/sage-HEAD/local/lib/python2.4/site-packages/ZConfig/loader.py   sage(Download)
    def normalizeURL(self, url):
        if self.isPath(url):
            url = "file://" + urllib.pathname2url(os.path.abspath(url))
        newurl, fragment = ZConfig.url.urldefrag(url)
        if fragment:
            raise ZConfig.ConfigurationError(
                "fragment identifiers are not supported",
def _url_from_file(file):
    name = getattr(file, "name", None)
    if name and name[0] != "<" and name[-1] != ">":
        return "file://" + urllib.pathname2url(os.path.abspath(name))
    else:
        return None
 
            dirname = os.path.abspath(dir)
            fn = os.path.join(dirname, file)
            if os.path.exists(fn):
                return "file://" + urllib.pathname2url(fn)
        else:
            raise ZConfig.SchemaResourceError("schema component not found",
                                              filename=file,

src/s/c/scrapy-HEAD/scrapy/utils/url.py   scrapy(Download)
def path_to_file_uri(path):
    """Convert local filesystem path to legal File URIs as described in:
    http://en.wikipedia.org/wiki/File_URI_scheme
    """
    x = urllib.pathname2url(os.path.abspath(path))
    if os.name == 'nt':
        x = x.replace('|', ':') # http://bugs.python.org/issue5861

src/s/c/Scrapy-0.10.3/scrapy/utils/url.py   Scrapy(Download)
def path_to_file_uri(path):
    """Convert local filesystem path to legal File URIs as described in:
    http://en.wikipedia.org/wiki/File_URI_scheme
    """
    x = urllib.pathname2url(os.path.abspath(path))
    if os.name == 'nt':
        x = x.replace('|', ':') # http://bugs.python.org/issue5861

src/g/r/grailbrowser-HEAD/src/protocols/fileAPI.py   grailbrowser(Download)
    def __init__(self, url, method, params):
        from urllib import url2pathname, pathname2url
        self.url = url
        self.redirect = None
        pathname = url2pathname(url)
        if not os.path.isabs(pathname):
            try:
                pathname = os.path.normpath(pathname)
                self.redirect = 1
        self.pathname = pathname
        self.url = "file:" + pathname2url(pathname)
        self.method = method
        self.params = params
        self.headers = {}

src/l/l/ll-xist-3.10/src/ll/url.py   ll-xist(Download)
			relchildname = os.path.join(name, childname)
			isdir = os.path.isdir(ful4childname)
			if (pattern is None or fnmatch.fnmatch(childname, pattern)) and which[isdir]:
				url = urllib.pathname2url(relchildname)
				if isdir:
					url += "/"
				yield URL(url)
	def listdir(self, url, pattern=None):
		filename = self._url2filename(url)
		result = []
		for (isdir, name) in self._send(filename, "listdir", pattern):
			name = urllib.pathname2url(name)
			if isdir:
				name += "/"
			result.append(URL(name))
		return result
 
	def files(self, url, pattern=None):
		filename = self._url2filename(url)
		return [URL(urllib.pathname2url(name)) for name in self._send(filename, "files", pattern)]
	def dirs(self, url, pattern=None):
		filename = self._url2filename(url)
		return [URL(urllib.pathname2url(name)+"/") for name in self._send(filename, "dirs", pattern)]
 
	def walk(self, url, pattern=None):
		filename = self._url2filename(url)
		iterator = self._send(filename, "walk", pattern)
		>>> url.File("a#b")
		URL('file:a%23b')
	"""
	name = urllib.pathname2url(os.path.expanduser(name))
	if name.startswith("///"):
		name = name[2:]
	url = URL(name)
		>>> url.Dir("a#b")
		URL('file:a%23b/')
	"""
	name = urllib.pathname2url(os.path.expanduser(name))
	if not name.endswith("/"):
		name += "/"
	if name.startswith("///"):
		path = path.rstrip(os.sep)
		if path.startswith("///"):
			path = path[2:]
		path = urllib.pathname2url(path.encode("utf-8"))
		if len(self) and not self.segments[-1]:
			path += "/"
		return Path(path)
		"""
		path = os.path.realpath(self.local())
		path = path.rstrip(os.sep)
		path = urllib.pathname2url(path.encode("utf-8"))
		if path.startswith("///"):
			path = path[2:]
		if len(self) and not self.segments[-1]:

src/z/a/zamboni-lib-HEAD/lib/python/rdflib/parser.py   zamboni-lib(Download)
import os
import __builtin__
import warnings
from urllib import pathname2url, url2pathname
from urllib2 import urlopen, Request, HTTPError
from urlparse import urljoin
from StringIO import StringIO
    def __init__(self, file):
        base = urljoin("file:", pathname2url(os.getcwd()))
        system_id = URIRef(file.name, base=base)
        super(FileInputSource, self).__init__(system_id)
        self.file = file
        self.setByteStream(file)
        # TODO: self.setEncoding(encoding)
                raise Exception("Unexpected type '%s' for source '%s'" % (type(source), source))
 
    if location is not None:
        base = urljoin("file:", "%s/" % pathname2url(os.getcwd()))
        absolute_location = URIRef(location, base=base).defrag()
        if absolute_location.startswith("file:///"):
            filename = url2pathname(absolute_location.replace("file:///", "/"))

src/z/p/zpkg-1.0.0/Dependencies/ZConfig-zpkg-1.0.0/ZConfig/loader.py   zpkg(Download)
    def normalizeURL(self, url):
        if self.isPath(url):
            url = "file://" + urllib.pathname2url(os.path.abspath(url))
        newurl, fragment = ZConfig.url.urldefrag(url)
        if fragment:
            raise ZConfig.ConfigurationError(
                "fragment identifiers are not supported",
def _url_from_file(file):
    name = getattr(file, "name", None)
    if name and name[0] != "<" and name[-1] != ">":
        return "file://" + urllib.pathname2url(os.path.abspath(name))
    else:
        return None
 
            dirname = os.path.abspath(dir)
            fn = os.path.join(dirname, file)
            if os.path.exists(fn):
                return "file://" + urllib.pathname2url(fn)
        else:
            raise ZConfig.SchemaResourceError("schema component not found",
                                              filename=file,

src/x/o/xooof-HEAD/python/xooof.recipe.gendoc/trunk/xooof/recipe/gendoc/resources/shared/scripts/toc2website.py   xooof(Download)
    def __init__(self,tocfile,tocreflistfile,targetdir):
        self.tocfile = tocfile
        if os.name == "posix":
            self.tocurl = urllib.pathname2url(os.path.abspath(tocfile))
        else:
            self.tocurl = "file:"+urllib.pathname2url(os.path.abspath(tocfile))
        #little hack
        #on some win32 platforms the urllib.pathname2url returns a discname with a pipe character instead of the colon.
        #don't know why
        self.tocurl = self.tocurl.replace('|',':')
        if os.name == "posix":
            self.baseurl = urllib.pathname2url(os.path.abspath(os.path.dirname(tocfile)))
        else:
            self.baseurl = "file:"+urllib.pathname2url(os.path.abspath(os.path.dirname(tocfile)))

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9  Next