| Home | Trees | Indices | Help |
|
|---|
|
|
TurboGears Front-to-Back Web Framework
Version: 1.1.4
Author: Kevin Dangoor
Copyright: Copyright 2005 - 2011 Kevin Dangoor and contributors
License: MIT
| Submodules | |
| |
| Functions | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
| Variables | |
mochikit = TGMochiKit(name='widget', charset=None, defer=False
|
|
| Function Details |
Return absolute URL (including schema and host to this server).
Tries to account for 'Host' header and reverse proxying
('X-Forwarded-Host').
The host name is determined this way:
* If the config setting 'tg.url_domain' is set and non-null, use this value.
* Else, if the 'base_url_filter.use_x_forwarded_host' config setting is
True, use the value from the 'Host' or 'X-Forwarded-Host' request header.
* Else, if config setting 'base_url_filter.on' is True and
'base_url_filter.base_url' is non-null, use its value for the host AND
scheme part of the URL.
* As a last fallback, use the value of 'server.socket_host' and
'server.socket_port' config settings (defaults to 'localhost:8080').
The URL scheme ('http' or 'http') used is determined in the following way:
* If 'base_url_filter.base_url' is used, use the scheme from this URL.
* If there is a 'X-Use-SSL' request header, use 'https'.
* Else, if the config setting 'tg.url_scheme' is set, use its value.
* Else, use the value of 'cherrypy.request.scheme'.
|
Exposes a method to the web.
By putting the expose decorator on a method, you tell TurboGears that
the method should be accessible via URL traversal. Additionally, expose
handles the output processing (turning a dictionary into finished
output) and is also responsible for ensuring that the request is
wrapped in a database transaction.
You can apply multiple expose decorators to a method, if
you'd like to support multiple output formats. The decorator that's
listed first in your code without as_format or accept_format is
the default that is chosen when no format is specifically asked for.
Any other expose calls that are missing as_format and accept_format
will have as_format implicitly set to the whatever comes before
the ":" in the template name (or the whole template name if there
is no ":". For example, <code>expose("json")</code>, if it's not
the default expose, will have as_format set to "json".
When as_format is set, passing the same value in the tg_format
parameter in a request will choose the options for that expose
decorator. Similarly, accept_format will watch for matching
Accept headers. You can also use both. expose("json", as_format="json",
accept_format="application/json") will choose JSON output for either
case: tg_format=json as a parameter or Accept: application/json as a
request header.
Passing allow_json=True to an expose decorator
is equivalent to adding the decorator just mentioned.
Each expose decorator has its own set of options, and each one
can choose a different template or even template engine (you can
use Kid for HTML output and Cheetah for plain text, for example).
See the other expose parameters below to learn about the options
you can pass to the template engine.
Take a look at the
<a href="tests/test_expose-source.html">test_expose.py</a> suite
for more examples.
@param template: "templateengine:dotted.reference" reference along the
Python path for the template and the template engine. For
example, "kid:foo.bar" will have Kid render the bar template in
the foo package.
@keyparam format: format for the template engine to output (if the
template engine can render different formats. Kid, for example,
can render "html", "xml" or "xhtml")
@keyparam content_type: sets the content-type http header
@keyparam allow_json: allow the function to be exposed as json
@keyparam fragment: for template engines (like Kid) that generate
DOCTYPE declarations and the like, this is a signal to
just generate the immediate template fragment. Use this
if you're building up a page from multiple templates or
going to put something onto a page with .innerHTML.
@keyparam as_format: designates which value of tg_format will choose
this expose.
@keyparam accept_format: which value of an Accept: header will
choose this expose.
All additional keyword arguments are passed as keyword args to the render
method of the template engine.
|
Redirect (via cherrypy.HTTPRedirect). Raises the exception instead of returning it, this to allow users to both call it as a function or to raise it as an exception. |
Update the system configuration from given config file and/or module. 'configfile' is a ConfigObj (INI-style) config file, 'modulename' a module path in dotted notation. The function looks for files with a ".cfg" extension if the given module name refers to a package directory or a file with the base name of the right-most part of the module path and a ".cfg" extension added. If both 'configfile' and 'modulname' are specified, the module is read first, followed by the config file. This means that the config file's options override the options in the module file. |
Computes relocatable URLs. tgpath can be a list or a string. If the path is absolute (starts with a "/"), the server.webpath, SCRIPT_NAME and the approot of the application are prepended to the path. In order for the approot to be detected properly, the root object must extend controllers.RootController. Query parameters for the URL can be passed in as a dictionary in the second argument and/or as keyword parameters where keyword args overwrite entries in the dictionary. Values which are a list or a tuple are used to create multiple key-value pairs. tgpath may also already contain a (properly escaped) query string seperated by a question mark ('?'), in which case additional query params are appended. |
Validate input.
|
| Variables Details |
mochikit
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Tue Jun 18 16:02:42 2013 | http://epydoc.sourceforge.net |