web.web.http

Package web :: Package web :: Module http |
[hide private]
[frames] | no frames]

# Module http

source code

HTTP Utilities (from web.py)

Functions | [hide private]
prefixurl(base=`'````'`) Sorry, this function is really difficult to explain. | source code
expires(delta) Outputs an `Expires` header for `delta` from now. | source code
lastmodified(date_obj) Outputs a `Last-Modified` header for `datetime`. | source code
modified(date=None, etag=None) Checks to see if the page has been modified since the version in the requester's cache. | source code
urlencode(query, doseq=0) Same as urllib.urlencode, but supports unicode strings. | source code
changequery(query=None, **kw) Imagine you're at `/foo?a=1&b=2`. | source code
url(path=None, doseq=False, **kw) Makes url by concatinating web.ctx.homepath and path and the query string created using the arguments. | source code
profiler(app) Outputs basic profiling information at the bottom of each response. | source code

Variables | [hide private]
| __package__ = ``'``web.web``'``

Function Details | [hide private]

### prefixurl(base=`'````'`) | source code
Sorry, this function is really difficult to explain. Maybe some other time.

### expires(delta) | source code
Outputs an `Expires` header for `delta` from now. `delta` is a `timedelta` object or a number of seconds.

### modified(date=None, etag=None) | source code
Checks to see if the page has been modified since the version in the requester's cache. When you publish pages, you can include `Last-Modified` and `ETag` with the date the page was last modified and an opaque token for the particular version, respectively. When readers reload the page, the browser sends along the modification date and etag value for the version it has in its cache. If the page hasn't changed, the server can just return `304 Not Modified` and not have to send the whole page again. This function takes the last-modified date `date` and the ETag `etag` and checks the headers to see if they match. If they do, it returns `True`, or otherwise it raises NotModified error. It also sets `Last-Modified` and `ETag` output headers.

### urlencode(query, doseq=0) | source code
Same as urllib.urlencode, but supports unicode strings.
    >>> urlencode({'text':'foo bar'})
    'text=foo+bar'
    >>> urlencode({'x': [1, 2]}, doseq=True)
    'x=1&x=2'

### changequery(query=None, **kw) | source code
Imagine you're at `/foo?a=1&b=2`. Then `changequery(a=3)` will return `/foo?a=3&b=2` -- the same URL but with the arguments you requested changed.