HowTo call a Python Method from DTML-Document
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"...
2a) no actual parameters, no formal parameters: obviously, cant reach REQUEST, since zope complains
nonexistent object or variable REQUEST. Info( (), {}, None )
You could use context.REQUEST in the python script here.
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"...
Isn't this the old "cached the result of evaluation even when it is incorrect" problem ? See Dieter's doc at http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html#c37ac15c14b4b... and http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html#c37ac15c14b4b... Florent -- Florent Guillaume, Nuxeo SARL (Paris, France) +33 1 40 33 79 87 http://nuxeo.com mailto:fg@nuxeo.com
participants (2)
-
Florent Guillaume -
hans