Class e.c.m.MediaUri:

Part of elisa.core.media_uri View In Hierarchy

Media URI management

An URI is structured like this:

  scheme://[user:password@]host[:port]/path[/][?params][#fragment]

This class is able to parse that and wrap access to all found attributes. When I'm parsing file:// URIs I'm allowed to replace paths like:

  ./path/to/foo

With the following:

  "%s/path/to/foo" % os.curdir
Instance Variablesschemethe URI scheme (type: string )
userthe optional username (type: string )
passwordthe optional password (type: string )
hostthe URI hostname (type: string )
portURI optional port. Set to 0 if not found (type: int )
paththe URI path, delimitted by slashes (/) (type: string )
fragmentoptional URI fragment (type: string )
extensionthe extension of the uri or empty (type: unicode )
filenamethe filename of the uri, means the part behind the last slash. Could be empty! (type: unicode )
labelthe label for this uri (per default the same as the filename) (type: unicode or elisa.extern.translator.Translateable )
parentthe parent uri (means the last part of the path is removed) (type: MediaUri )
Line # Kind Name Docs
188 Method __init__ Create an Uri from various representations.
276 Method path__get Undocumented
283 Method path__set Undocumented
376 Method set_params Set a lot of parameters at one time. Attention: it simply
387 Method set_param Set the parameter 'name' to 'value'. If this parameter is already
401 Method get_param Get the value for the parameter 'name'. If there is none found, return
419 Method get_params Get all params as a dict.
427 Method get_params_string Get the params as a one-line string (excluding a leading '?').
435 Method del_param Delete the paramter with the name 'name' (and it's value), if it is
446 Method extension__get Undocumented
454 Method filename__get Return the filename of the Uri.
473 Method label__set Undocumented
481 Method label__get Return a displayable string designing the Uri. Return last path
504 Method parent__get Return the parent URI.
525 Method join Append the given path to my path attribute
578 Method __str__ Byte string representation of the URI
590 Method __cmp__ Compare myself with another uri.
602 Method __eq__
613 Method __ne__
622 Method __nonzero__ Undocumented
625 Method __contains__ Undocumented
628 Method __add__ Undocumented
631 Method endswith Undocumented
634 Method __getslice__ Undocumented
267 Method _uri_re Undocumented
286 Method _parse Undocumented
548 Method _to_unicode Textual representation of the URI
def __init__(self, data):
Create an Uri from various representations.

Representation can be either a string containing the uri or the components of the uri stored in a dictionary.

ParametersdataAn uri stored in a unicode string or described by its components (scheme, user, password, host, port, path, params, fragment), each of them being a string (type: string or dict )
RaisesTypeErrorIf none of location or parts has been provided
ParseExceptionIf the location wasn't correctly parsed
def _uri_re(self):
Undocumented
def path__get(self):
Undocumented
def path__set(self, value):
Undocumented
def _parse(self, location):
Undocumented
def set_params(self, values):
Set a lot of parameters at one time. Attention: it simply overrides already existing values!
Parametersvaluesa dictionary, where the parameter names are pointing to the unquoted values. (type: dict )
def set_param(self, name, value):
Set the parameter 'name' to 'value'. If this parameter is already existing it is overritten. The value shouldn't be quoted yet, because it is quoted here. That might lead to very bad parameter values!
Parametersnamethe name of the paramter (type: Unicode )
valueunquoted value for the parameter (type: Unicode )
def get_param(self, name, default=u''):
Get the value for the parameter 'name'. If there is none found, return the value of 'default'. If 'default' is not set it is an empty unicode.
Parametersnamethe name of the parameter (type: Unicode )
defaultvalue that should be returned, if the parameter is not found (per default that is an empty Unicode) (type: Unicode )
Returnsparamter or the value of default, if the paramter was not found (type: unquoted Unicode )
def get_params(self):
Get all params as a dict.
Returnsof quoted key value pairs (type: dict )
def get_params_string(self):
Get the params as a one-line string (excluding a leading '?').
Returnskey1=value1&key2=value2 (type: unicode )
def del_param(self, name):
Delete the paramter with the name 'name' (and it's value), if it is found in the list of parameters.
Parametersnamethe name of the paramter to delete (type: Unicode )
def extension__get(self):
Undocumented
def filename__get(self):
Return the filename of the Uri.

Returns last path component label parameter like uri://path/to/foo then 'foo' is returned.

If there is no path, like in uri://host:port/ or in uri:// an empty unicode is returned

def label__set(self, value):
Undocumented
def label__get(self):
Return a displayable string designing the Uri. Return last path component if the URI has no predetermined label instance attribute set.
def parent__get(self):
Return the parent URI.

If the URI is like uri://path/to/foo return uri://path/to/

def join(self, path):
Append the given path to my path attribute
Parameterspaththe path to append at the end of my path (type: string )
Returns (type: MediaUri )
def _to_unicode(self):
Textual representation of the URI
Returns (type: unicode )
def __str__(self):
Byte string representation of the URI
Returns (type: string )
def __cmp__(self, other_uri):
Compare myself with another uri.
Parametersother_uriThe URI I'm comparing myself with (type: MediaUri )
Returns (type: int )
RaisesTypeErrorWhen trying to compare with non-MediaUri object
def __eq__(self, other_uri):
RaisesTypeErrorWhen trying to compare with non-MediaUri object
def __ne__(self, other_uri):
RaisesTypeErrorWhen trying to compare with non-MediaUri object
def __nonzero__(self):
Undocumented
def __contains__(self, component):
Undocumented
def __add__(self, path):
Undocumented
def endswith(self, character):
Undocumented
def __getslice__(self, i, j):
Undocumented
API Documentation for Elisa Media Center, generated by pydoctor at 2009-02-16 19:15:05.