Mercurial > p > roundup > code
comparison doc/customizing.txt @ 2046:f913b6beac35
document and make easier the actions-returning-content idiom
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 25 Feb 2004 03:39:53 +0000 |
| parents | be047db3dd3d |
| children | d8c7fd205cd8 |
comparison
equal
deleted
inserted
replaced
| 2045:d124af927369 | 2046:f913b6beac35 |
|---|---|
| 1 =================== | 1 =================== |
| 2 Customising Roundup | 2 Customising Roundup |
| 3 =================== | 3 =================== |
| 4 | 4 |
| 5 :Version: $Revision: 1.116 $ | 5 :Version: $Revision: 1.117 $ |
| 6 | 6 |
| 7 .. This document borrows from the ZopeBook section on ZPT. The original is at: | 7 .. This document borrows from the ZopeBook section on ZPT. The original is at: |
| 8 http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx | 8 http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx |
| 9 | 9 |
| 10 .. contents:: | 10 .. contents:: |
| 2146 | 2146 |
| 2147 <input type="hidden" name="@action" value="myaction"> | 2147 <input type="hidden" name="@action" value="myaction"> |
| 2148 | 2148 |
| 2149 where "myaction" is the name you registered in the previous step. | 2149 where "myaction" is the name you registered in the previous step. |
| 2150 | 2150 |
| 2151 Actions may return content to the user | |
| 2152 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| 2153 | |
| 2154 Actions generally perform some database manipulation and then pass control | |
| 2155 on to the rendering of a template in the current context (see `Determining | |
| 2156 web context`_ for how that works.) Some actions will want to generate the | |
| 2157 actual content returned to the user. Action methods may return their own | |
| 2158 content string to be displayed to the user, overriding the templating step. | |
| 2159 In this situation, we assume that the content is HTML by default. You may | |
| 2160 override the content type indicated to the user by calling ``setHeader``:: | |
| 2161 | |
| 2162 self.client.setHeader('Content-Type', 'text/csv') | |
| 2163 | |
| 2164 This example indicates that the value sent back to the user is actually | |
| 2165 comma-separated value content (eg. something to be loaded into a | |
| 2166 spreadsheet or database). | |
| 2167 | |
| 2151 | 2168 |
| 2152 Examples | 2169 Examples |
| 2153 ======== | 2170 ======== |
| 2154 | 2171 |
| 2155 .. contents:: | 2172 .. contents:: |
