close
Warning:
Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.
- Timestamp:
-
Sep 17, 2008, 10:07:26 PM (16 years ago)
- Author:
-
cmlenz
- Comment:
-
Some typo fixes and clarifications
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v15
|
v16
|
|
1 | 1 | = Request Handlers = |
2 | 2 | |
3 | | A request handler is a neutral name for what some other frameworks call “controllers” or “views”. It is simply a Python function that accepts the request and response objects as parameters, and returns a response. |
| 3 | A request handler is a neutral name for what some other frameworks call “controllers” or “views”. It is simply a Python function that accepts the request and response objects as parameters, and processes the request to generate a response in one way or another. |
4 | 4 | |
5 | 5 | {{{ |
… |
… |
|
58 | 58 | }}} |
59 | 59 | |
60 | | If you do want to render a template, use the `render()` function to return a Genshi stream from the request handler. You pass any template data into the `render()` function as keyword arguments, and it will generate an output stream from the template based on the template data. The `render()` function also lets you override the template filename specified using the `@output` decorator: simple pass the template name as the first (and only) positional argument into `render()`. |
| 60 | If you do want to render a template, use the `render()` function to return a Genshi stream from the request handler. You pass any template data into the `render()` function as keyword arguments, and it will generate an output stream from the template based on the template data. The `render()` function also lets you override the template filename specified using the `@output` decorator: simply pass the template name as the first (and only) positional argument into `render()`. |
61 | 61 | |
62 | 62 | === Default Template Data === |
… |
… |
|
77 | 77 | `ngettext()`:: Function for translating a message including plural forms |
78 | 78 | `path_to()`:: Function for generating URLs based on the [UrlRouting routing configuration] |
79 | | `request`:: The `Request` object |
80 | | `response`:: The `Response` object |
81 | | `separated()`:: Helper function that adds separator strings to a list of strings |
| 79 | `request`:: The `Request` object (as provided by the `webob` package) |
| 80 | `response`:: The `Response` object (as provided by the `webob` package) |
| 81 | `separated()`:: Helper function that converts a list of strings into a single string with added separators |
82 | 82 | `time`:: Python `time` class from the `datetime` module |
83 | 83 | `timedelta`:: Python `timedelta` class from the `datetime` module |
84 | | `truncate()`:: Helper function that truncates a string to a specified limit of characters |
| 84 | `truncate()`:: Helper function that truncates a string to a specified limit of characters, taking word boundaries into account |
85 | 85 | `XML()`:: Function to parse a string as XML and return a markup stream |
86 | 86 | |