[Zope] HowTo call a Python Method from DTML-Document

hans hans@beehive.de
Thu, 04 Oct 2001 14:03:06 +0100


on Zope 2.1.6 (python 1.5.2)

==> Python Method Check
# no parameters, should check REQUEST.form
# and for each checked form-field add a corresponding
# diagnostic
data = REQUEST.form
diag = {}
diagnose = 1 # erverything ok

if data['fname'   ] == '': # required
 diag.set('fname'   , 'required' )
 diagnose = 0
==> DTML-Document Form calls
<dtml-call "Check( ... )">

1) this is not documented in Zope Book Appendix B
(calling DTML-Docs & DTML-Methods is documented well)
2) i tried various parameters (the "..."), none of which works
2a) no actual parameters, no formal parameters:
obviously, cant reach REQUEST, since zope complains
>>nonexistent object or variable REQUEST.
>>Info( (), {}, None )
2b): giving Check formal Parameter REQ, call Check( REQUEST)
results in REQ=the html-string delivered from REQUEST.__call__
(the same as <dtml-var REQUEST>) and a string sure has no attribute
"set"...