[Zope] Return ZPT with parameters

Dieter Maurer dieter@handshake.de
Thu, 31 Oct 2002 21:45:15 +0100


Hedley Roos writes:
 > ....
 > A) return self.index_html()
 > This does work:
 > B) return
 > self.REQUEST.RESPONSE.redirect(self.index_html().absolute_url())
The main problem with "B" is that "self.index_html()" almost surely
returns a string and a string does not have a method "absolute_url".

  Try: "self.index_html.absolute_url()" instead.

 > The problem with B is that I cannot pass parameters to the ZPT (I need to do
 > this, but this is beyond the scope of the question).
You can.

    zpt(a standard parameter list)

    You find your passed in parameters in the standard TALES variable "options".
    This is a dictionay. Positional parameters are available via
    the tuple "args" and keyword parameters are available via their
    key.

 > To summarize: I would like to use A and have ZPT listInstances display the
 > newly added instance.
This has nothing to do with passing parameters...

   When a subsequent "listInstances" does not show newly created
   instances, this may be a cache problem.

   Force your browser to reload the page. Do you now see the
   new instance -- then it is a cache problem.

   Search the mailing list archives for "cache control".
   There is also a HowTo on Zope.org.


Dieter