[Zope] [solved] - Acquistion mistery

D2 borelan@wanadoo.fr
Sat, 17 May 2003 13:47:09 -0400


D2 a écrit:
> Hello,
> 
> i have three objects :
>     testform (a ZPT)
>     testscript (a PythonScript)
>     testdtml (a DTML Method)
> located in a standard Zope root.
> 
> I fill in testform fields then submit the form to testscript wich set a 
> property (request.set('tesfield', 'Hi there') in the request and then 
> calls testdtml with the request object.
> testdtml displays REQUEST with the fields from testform and testfield 
> set in tescript, without problems if i don't use <dtml-var 
> standard_html_header>. If i do, the publisher returns a KeyError : 
> standard_html_header.
> 
> I don't understand why standard_html_header is not acquired.
> 
> Does somebody explain to me how acquisition behaviour is affected by my 
> stuff.
> 
> More generally, my goal is to understand how i can  pass parameters to 
> forms from scripts, other forms and object methods so don't hesitate to 
> feed me with some theory.
> 
> here is the source of testscript:
> 
> # Example code:
> # Import a standard function, and get the HTML request and response 
> objects.
> from Products.PythonScripts.standard import html_quote
> request = container.REQUEST
> RESPONSE =  request.RESPONSE
> request.set('testfield','Hi there')
> destination=getattr(container,'testdtml')
> kw={}
> kw['REQUEST']=container.REQUEST 
> return apply(destination, (), kw)

Well, testdtml is a method so i used it as a method passing arguments 
between parenthesis.


  # Example code:
  # Import a standard function, and get the HTML request and response
  objects.
  from Products.PythonScripts.standard import html_quote
  request = container.REQUEST
  RESPONSE =  request.RESPONSE
  request.set('testfield','Hi there')
  destination=getattr(container,'testdtml')
  return destination(container, request)

> 
> 
> 
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope-dev )
>