Skip to content

Commit a774c72

Browse files
author
Richard Jones
committed
tweak
1 parent b2f126a commit a774c72

File tree

1 file changed

+63
-51
lines changed

1 file changed

+63
-51
lines changed

doc/templating.txt

Lines changed: 63 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
HTML Templating Mechanisms
33
==========================
44

5-
:Version: $Revision: 1.4 $
5+
:Version: $Revision: 1.5 $
66

77
Current Situation and Issues
88
============================
@@ -114,49 +114,57 @@ variables defined:
114114
*util*
115115
utility methods
116116

117-
Then accesses through an *item*::
117+
Accesses through a class (either through *class* or *db.<classname>*):
118118

119-
class HTMLItem:
120-
def __getattr__(self, attr):
121-
''' return an HTMLItem instance '''
122-
def history(self, ...)
123-
def classhelp(self, ...)
124-
def remove(self, ...)
119+
class HTMLItem:
120+
def __getattr__(self, attr):
121+
''' return an HTMLItem instance '''
122+
def classhelp(self, ...)
123+
def list(self, ...)
124+
125+
Accesses through an *item*::
126+
127+
class HTMLItem:
128+
def __getattr__(self, attr):
129+
''' return an HTMLItem instance '''
130+
def history(self, ...)
131+
def classhelp(self, ...)
132+
def remove(self, ...)
125133

126134
String, Number, Date, Interval HTMLProperty
127135
a wrapper object which may be stringified for the current plain() behaviour
128136
and has methods emulating all the current display functions, so
129137
``item/name/plain`` would emulate the current ``call="plain()``". Also,
130138
``python:item.name.plain(name=value)`` would work just fine::
131139

132-
class HTMLProperty:
133-
def __init__(self, instance, db, ...)
134-
def __str__(self):
135-
return self.plain()
140+
class HTMLProperty:
141+
def __init__(self, instance, db, ...)
142+
def __str__(self):
143+
return self.plain()
136144

137-
class StringHTMLProperty(HTLProperty):
138-
def plain(self, ...)
139-
def field(self, ...)
140-
def stext(self, ...)
141-
def multiline(self, ...)
142-
def email(self, ...)
145+
class StringHTMLProperty(HTLProperty):
146+
def plain(self, ...)
147+
def field(self, ...)
148+
def stext(self, ...)
149+
def multiline(self, ...)
150+
def email(self, ...)
143151

144-
class NumberHTMLProperty(HTMLProperty):
145-
def plain(self, ...)
146-
def field(self, ...)
152+
class NumberHTMLProperty(HTMLProperty):
153+
def plain(self, ...)
154+
def field(self, ...)
147155

148-
class BooleanHTMLProperty(HTMLProperty):
149-
def plain(self, ...)
150-
def field(self, ...)
156+
class BooleanHTMLProperty(HTMLProperty):
157+
def plain(self, ...)
158+
def field(self, ...)
151159

152-
class DateHTMLProperty(HTMLProperty):
153-
def plain(self, ...)
154-
def field(self, ...)
155-
def reldate(self, ...)
160+
class DateHTMLProperty(HTMLProperty):
161+
def plain(self, ...)
162+
def field(self, ...)
163+
def reldate(self, ...)
156164

157-
class IntervalHTMLProperty(HTMLProperty):
158-
def plain(self, ...)
159-
def field(self, ...)
165+
class IntervalHTMLProperty(HTMLProperty):
166+
def plain(self, ...)
167+
def field(self, ...)
160168

161169
Link HTMLProperty
162170
the wrapper object would include the above as well as being able to access
@@ -167,33 +175,33 @@ Link HTMLProperty
167175
identified by the assignedto property on item, and then the name property of
168176
that user)::
169177

170-
class LinkHTMLProperty(HTMLProperty):
171-
''' Be a HTMLItem too '''
172-
def __getattr__(self, attr):
173-
''' return a new HTMLProperty '''
174-
def download(self, ...)
175-
def checklist(self, ...)
178+
class LinkHTMLProperty(HTMLProperty):
179+
''' Be a HTMLItem too '''
180+
def __getattr__(self, attr):
181+
''' return a new HTMLProperty '''
182+
def download(self, ...)
183+
def checklist(self, ...)
176184

177185
Multilink HTMLProperty
178186
the wrapper would also be iterable, returning a wrapper object like the Link
179187
case for each entry in the multilink::
180188

181-
class MultilinkHTMLProperty(HTMLProperty):
182-
def __len__(self):
183-
''' length of the multilink '''
184-
def __getitem(self, num):
185-
''' return a new HTMLItem '''
186-
def checklist(self, ...)
187-
def list(self, ...)
189+
class MultilinkHTMLProperty(HTMLProperty):
190+
def __len__(self):
191+
''' length of the multilink '''
192+
def __getitem(self, num):
193+
''' return a new HTMLItem '''
194+
def checklist(self, ...)
195+
def list(self, ...)
188196

189197
*util*
190198
the util object will handle::
191199

192-
class Util:
193-
def __init__(self, ...)
194-
def filterspec(self, ...)
195-
def note(self, ...)
196-
def submit(self, ...)
200+
class Util:
201+
def __init__(self, ...)
202+
def filterspec(self, ...)
203+
def note(self, ...)
204+
def submit(self, ...)
197205

198206
Action
199207
======
@@ -208,7 +216,11 @@ Action
208216
we'd be installing a version in site-packages, which would be bad.
209217

210218
The latter may allow nicer integration with Zope itself, giving Zope
211-
Roundup users access to acquired information in their templates.
219+
Roundup users access to acquired information in their templates. We could
220+
get around that by modifying the ZRoundup interface to use the "real Zope"
221+
ZPT. Maybe.
222+
223+
2. Implement the Roundup infrastructure described in the `implementation`_
224+
above.
212225

213-
2. Implement the Roundup infrastructure detailed in the `implementation`_ above.
214226

0 commit comments

Comments
 (0)