Mercurial > p > roundup > code
comparison doc/templating.txt @ 966:cc8f9193bf2f
more tweaks
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 22 Aug 2002 00:14:34 +0000 |
| parents | 6010f0078800 |
| children | 22e6707a993a |
comparison
equal
deleted
inserted
replaced
| 965:b2c537f51fc5 | 966:cc8f9193bf2f |
|---|---|
| 1 ========================== | 1 ========================== |
| 2 HTML Templating Mechanisms | 2 HTML Templating Mechanisms |
| 3 ========================== | 3 ========================== |
| 4 | 4 |
| 5 :Version: $Revision: 1.9 $ | 5 :Version: $Revision: 1.10 $ |
| 6 | 6 |
| 7 Current Situation and Issues | 7 Current Situation and Issues |
| 8 ============================ | 8 ============================ |
| 9 | 9 |
| 10 Syntax | 10 Syntax |
| 195 class HTMLClass: | 195 class HTMLClass: |
| 196 def __getattr__(self, attr): | 196 def __getattr__(self, attr): |
| 197 ''' return an HTMLItem instance ''' | 197 ''' return an HTMLItem instance ''' |
| 198 def classhelp(self, ...) | 198 def classhelp(self, ...) |
| 199 def list(self, ...) | 199 def list(self, ...) |
| 200 def filter(self): | |
| 201 ''' Return a list of items from this class, filtered and sorted | |
| 202 by the current requested filterspec/filter/sort/group args | |
| 203 ''' | |
| 200 | 204 |
| 201 Accesses through an *item*:: | 205 Accesses through an *item*:: |
| 202 | 206 |
| 203 class HTMLItem: | 207 class HTMLItem: |
| 204 def __getattr__(self, attr): | 208 def __getattr__(self, attr): |
| 278 | 282 |
| 279 class Request: | 283 class Request: |
| 280 def __init__(self, ...) | 284 def __init__(self, ...) |
| 281 def filterspec(self, ...) | 285 def filterspec(self, ...) |
| 282 | 286 |
| 283 Action | 287 Template files |
| 284 ====== | 288 ~~~~~~~~~~~~~~ |
| 285 | 289 |
| 286 1. Investigate how PageTemplates would be integrated into Roundup: | 290 Each instance will have the opportunity to supply the following templates: |
| 287 | 291 |
| 288 - we could go for a fully-divorced-from-Zope approach, which would involve | 292 page |
| 289 bundling PageTemplates/TAL/ZTUtils in with Roundup, with all the | 293 This is the overall page look template, and includes at some point a TAL |
| 290 Zope-specific bits removed. | 294 command that includes the variable "content". This variable causes the actual |
| 291 - we could try to coexist with a Zope installation, but there the problem | 295 page content to be generated. |
| 292 would be that Zope includes its own copy of PageTemplates/TAL/ZTUtils and | 296 |
| 293 we'd be installing a version in site-packages, which would be bad. | 297 *.index |
| 294 | 298 Displays a list of items from the database, and a "filter refinement" form. |
| 295 The latter may allow nicer integration with Zope itself, giving Zope | 299 Would perform a TAL ``repeat`` command using the list supplied by |
| 296 Roundup users access to acquired information in their templates. We could | 300 ``class/filter``. This deviates from the current situation in that currently |
| 297 get around that by modifying the ZRoundup interface to use the "real Zope" | 301 the index template specifies a single row, and the filter part is |
| 298 ZPT. Maybe. | 302 automatically generated. |
| 299 | 303 |
| 300 2. Implement the Roundup infrastructure described in the `implementation`_ | 304 *.item |
| 301 above. | 305 Displays a single item from the database using the *classname* variable (that |
| 302 | 306 is, the variable of the same name as the class being displayed. If |
| 303 | 307 |
| 308 *.filter | |
| 309 Displays a full search form for a class. | |
| 310 | |
| 311 Note that the newitem template doesn't really apply any more because the item | |
| 312 templates may determine whether the page has an existing item to render. | |
| 313 | |
| 314 | |
| 315 Integrating Code | |
| 316 ~~~~~~~~~~~~~~~~ | |
| 317 | |
| 318 We will install PageTemplates, TAL and ZTUtils in site-packages. If there is a | |
| 319 local Zope installation, it will use its own PageTemplates code (Zope modifies | |
| 320 the module search path to give precedence to its own module library). | |
| 321 | |
| 322 We will then install the trivial MultiMapping and ComputedAttribute modules in | |
| 323 the Roundup package, and have some import trickery that determines whether | |
| 324 they are required, and if so they will be imported as if they were at the | |
| 325 "top level" of the module namespace. | |
| 326 |
