|
1 | | -# $Id: client.py,v 1.12 2002-09-05 01:27:42 richard Exp $ |
| 1 | +# $Id: client.py,v 1.13 2002-09-05 04:46:36 richard Exp $ |
2 | 2 |
|
3 | 3 | __doc__ = """ |
4 | 4 | WWW request handler (also used in the stand-alone server). |
@@ -192,22 +192,34 @@ def determine_user(self): |
192 | 192 | self.opendb(self.user) |
193 | 193 |
|
194 | 194 | def determine_context(self, dre=re.compile(r'([^\d]+)(\d+)')): |
195 | | - ''' Determine the context of this page: |
196 | | -
|
197 | | - home (default if no url is given) |
198 | | - classname |
199 | | - designator (classname and nodeid) |
200 | | -
|
201 | | - The desired template to be rendered is also determined There |
202 | | - are two exceptional contexts: |
203 | | -
|
204 | | - _file - serve up a static file |
205 | | - path len > 1 - serve up a FileClass content |
206 | | - (the additional path gives the browser a |
207 | | - nicer filename to save as) |
| 195 | + ''' Determine the context of this page from the URL: |
| 196 | +
|
| 197 | + The URL path after the instance identifier is examined. The path |
| 198 | + is generally only one entry long. |
| 199 | +
|
| 200 | + - if there is no path, then we are in the "home" context. |
| 201 | + * if the path is "_file", then the additional path entry |
| 202 | + specifies the filename of a static file we're to serve up |
| 203 | + from the instance "html" directory. Raises a SendStaticFile |
| 204 | + exception. |
| 205 | + - if there is something in the path (eg "issue"), it identifies |
| 206 | + the tracker class we're to display. |
| 207 | + - if the path is an item designator (eg "issue123"), then we're |
| 208 | + to display a specific item. |
| 209 | + * if the path starts with an item designator and is longer than |
| 210 | + one entry, then we're assumed to be handling an item of a |
| 211 | + FileClass, and the extra path information gives the filename |
| 212 | + that the client is going to label the download with (ie |
| 213 | + "file123/image.png" is nicer to download than "file123"). This |
| 214 | + raises a SendFile exception. |
| 215 | +
|
| 216 | + Both of the "*" types of contexts stop before we bother to |
| 217 | + determine the template we're going to use. That's because they |
| 218 | + don't actually use templates. |
208 | 219 |
|
209 | 220 | The template used is specified by the :template CGI variable, |
210 | 221 | which defaults to: |
| 222 | +
|
211 | 223 | only classname suplied: "index" |
212 | 224 | full item designator supplied: "item" |
213 | 225 |
|
|
0 commit comments