gnomevfs.URI

gnomevfs.URI — Object encapsulating a URI

Synopsis

class gnomevfs.URI:
    gnomevfs.URI(text_uri)
def append_file_name(file_name)
def append_path(path)
def append_string(path)
def copy()
def is_parent(item, recursive)
def resolve_relative(relative_reference)

Description

Attributes

dirnameRead/WriteThe name of the directory in which the file pointed to by this URI is located.
fragment_identifierRead/Write 
host_nameReadServer hostname (for remote schemes).
host_portReadServer port (for remote schemes).
is_localRead/WriteWhether the URI is a local filesystem.
parentRead/WriteThe parent URI.
passwordReadPassword (for schemes which require authorization).
pathRead/WriteThe full path name.
schemeRead/WriteThe URI scheme (`gzip', `tar', `http', etc).
short_nameRead/WriteThe base name for the file referred to by this URI. This matches the XPG definition of a basename. This is useful when you want the name of the URI target, but don't care whether the URI points to a file or directory. If the URI points to the root of a domain, this is the host name.
short_path_nameRead/WriteSame as short_name, but if the URI points to the root of a domain, this is equal to /
toplevelRead/WriteThe toplevel URI
user_nameReadUser name (for schemes which require authorization).

Constructor

            gnomevfs.URI(text_uri)
      
text_uri:A string representing the URI.
Returns:the new gnomevfs.URI

Methods

gnomevfs.URI.append_file_name

            def append_file_name(file_name)
      
file_name:The file name to append.
Returns:The new URI.

Create a new URI by appending file_name. This will add the appropriate directory separator if necessary.

gnomevfs.URI.append_path

            def append_path(path)
      
path:The path to append (unescaped)
Returns:The new URI.

Create a new URI by appending path. This will add the appropriate directory separator if necessary.

gnomevfs.URI.append_string

            def append_string(path)
      
path:The path to append (fully escaped)
Returns:The new URI.

Create a new URI by appending path. This will add the appropriate directory separator if necessary.

gnomevfs.URI.copy

            def copy()
      
Returns:A copy of this URI.

Create a copy of this URI.

gnomevfs.URI.is_parent

            def is_parent(item, recursive)
      
item:The item to search for.
recursive:Whether to check the entire hierarchy.
Returns:True if item is a child of self.

Check if this URI is a parent of item. If recursive is True, check the entire hierarchy.

gnomevfs.URI.resolve_relative

            def resolve_relative(relative_reference)
      
relative_reference:A string representing the (possibly) relative URI.
Returns:The new URI.

Create a new URI from relative_reference relative to self. The resolution algorithm follows RFC 2396. For details, see section 5.2 of http://www.ietf.org/rfc/rfc2396.txt .

In short, if the base uri ends in '/', relative_reference is appended to base, otherwise it replaces the part of base after the last '/'.