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:
-
Jul 9, 2008, 10:07:38 AM (16 years ago)
- Author:
-
cmlenz
- Comment:
-
--
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v8
|
v9
|
|
39 | 39 | First, there's the `@output` decorator, which you use to specify the name of the template file, the serialization method, the response MIME type and encoding, and other serialization options such as the `DOCTYPE` to use and so on. |
40 | 40 | |
41 | | Note that all of these are optional. For example, you can omit the template file name for a response that doesn't involve template rendering, and just use the `mimetype` and `encoding` options: |
| 41 | {{{ |
| 42 | #!python |
| 43 | from diva.templating import output, render |
| 44 | |
| 45 | @output('index.html', method='html', doctype='html-strict') |
| 46 | def index(request, response): |
| 47 | return render(message='Hello, world!') |
| 48 | }}} |
| 49 | |
| 50 | Note that all of the arguments to `@output` are optional. For example, you can omit the template file name for a response that doesn't involve template rendering, and just use the `mimetype` and `encoding` options: |
42 | 51 | |
43 | 52 | {{{ |