Beispiel #1
0
    def _get_g_file(self, uri):
        if type(uri) is not str:
            raise TypeError, 'unexpected "%s"' % repr(uri)

        # Resolve or not ?

        # Your folder is None => new File
        if self._folder is None:
            g_file = File(uri)
        else:
            # Split the uri
            scheme, authority, path, query, fragment = urlsplit(uri)

            # A scheme or an authority => new File
            # XXX This is not truly exact:
            #     we can have a scheme and a relative path.
            if scheme or authority:
                g_file = File(uri)
            else:
                # Else we resolve the path
                g_file = self._folder.resolve_relative_path(uri)

        # Automount a ftp server ?
        if g_file.get_uri_scheme () == 'ftp':
            # Mount the server
            AnonymousConnection(g_file)

        return g_file