Part of nevow.url View Source View In Hierarchy
Represents a URL and provides a convenient API for modifying its parts.
A URL is split into a number of distinct parts: scheme, netloc (domain
name), path segments, query parameters and fragment identifier.
Methods are provided to modify many of the parts of the URL, especially
the path and query parameters. Values can be passed to methods as-is;
encoding and escaping is handled automatically.
There are a number of ways to create a URL:
* Standard Python creation, i.e. __init__.
* fromString, a class method that parses a string.
* fromContext, a class method that creates a URL to represent the
the current URL in the path traversal process.
URL instances can be used in a stan tree or to fill template slots. They can
also be used as a redirect mechanism - simply return an instance from an
IResource method. See URLRedirectAdapter for details.
| Line # | Kind | Name | Docs |
|---|---|---|---|
| 51 | Method | __init__ | Undocumented |
| 64 | Method | __eq__ | Undocumented |
| 72 | Method | __ne__ | Undocumented |
| 87 | Class Method | fromString | Undocumented |
| 96 | Class Method | fromRequest | Undocumented |
| 108 | Class Method | fromContext | Create a URL object that represents the current URL in the traversal |
| 120 | Method | pathList | Undocumented |
| 128 | Method | sibling | Construct a url where the given path segment is a sibling of this url |
| 135 | Method | child | Construct a url where the given path segment is a child of this url |
| 145 | Method | isRoot | Undocumented |
| 148 | Method | parent | Undocumented |
| 156 | Method | curdir | Construct a url which is a logical equivalent to '.' |
| 170 | Method | up | Pop a URL segment from this url. |
| 178 | Method | parentdir | Construct a url which is the parent of this url's directory; |
| 199 | Method | click | Build a path by merging 'href' and this path. |
| 240 | Method | queryList | Return current query as a list of tuples. |
| 248 | Method | add | Add a query argument with the given value |
| 256 | Method | replace | Remove all existing occurrances of the query |
| 273 | Method | remove | Remove all query arguments with the given name |
| 281 | Method | clear | Remove all existing query arguments |
| 292 | Method | secure | Modify the scheme to https/http and return the new URL. |
| 314 | Method | anchor | Modify the fragment/anchor and return a new URL. An anchor of |
| 322 | Method | __str__ | Undocumented |
| 325 | Method | __repr__ | Undocumented |
>>> print URL.fromString('http://foo.com/bar').curdir() http://foo.com/ >>> print URL.fromString('http://foo.com/bar/').curdir() http://foo.com/bar/
>>> print URL.fromString('http://foo.com/bar/file').parentdir() http://foo.com/ >>> print URL.fromString('http://foo.com/bar/dir/').parentdir() http://foo.com/bar/
Build a path by merging 'href' and this path.
Return a path which is the URL where a browser would presumably take you if you clicked on a link with an 'href' as given.| Parameters | secure | choose between https and http, default to True (https) |
| port | port, override the scheme's normal port |