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 Variables | scheme | the URI scheme (type: string ) |
user | the optional username (type: string ) | |
password | the optional password (type: string ) | |
host | the URI hostname (type: string ) | |
port | URI optional port. Set to 0 if not found (type: int ) | |
path | the URI path, delimitted by slashes (/) (type: string ) | |
fragment | optional URI fragment (type: string ) | |
extension | the extension of the uri or empty (type: unicode ) | |
filename | the filename of the uri, means the part behind the last slash. Could be empty! (type: unicode ) | |
label | the label for this uri (per default the same as the filename)
(type: unicode or elisa.extern.translator.Translateable
) | |
parent | the 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 |
Representation can be either a string containing the uri or the components of the uri stored in a dictionary.
Parameters | data | An 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 ) |
Raises | TypeError | If none of location or parts has been provided |
ParseException | If the location wasn't correctly parsed |
Parameters | values | a dictionary, where the parameter names are pointing to the unquoted values. (type: dict ) |
Parameters | name | the name of the paramter (type: Unicode ) |
value | unquoted value for the parameter (type: Unicode ) |
Parameters | name | the name of the parameter (type: Unicode ) |
default | value that should be returned, if the parameter is not found (per default that is an empty Unicode) (type: Unicode ) | |
Returns | paramter or the value of default, if the paramter was not found (type: unquoted Unicode ) |
Returns | key1=value1&key2=value2 (type: unicode ) |
Parameters | name | the name of the paramter to delete (type: Unicode ) |
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
If the URI is like uri://path/to/foo return uri://path/to/
Parameters | path | the path to append at the end of my path (type: string ) |
Returns | (type: MediaUri
) |
Parameters | other_uri | The URI I'm comparing myself with
(type: MediaUri
) |
Returns | (type: int
) | |
Raises | TypeError | When trying to compare with non-MediaUri object |