On Jul 16, 2005, at 8:10 PM, John Smith wrote:
I hope I have the right mailing list. Perhaps someone
can help me with a fairly basic question.
When I used Zope 2, I used the following idiom for
Send http POST to Script(Python) or External Method,
which would then return a ZPT like this:
return context.myZPT(arg1=xyz, arg2=abc, etcetera). In
the ZPT, I could then access arg1, arg2 via the
'options' TAL name.
FWIW, the same behavior holds true in Zope 3 as well for
"zope.app.pagetemplate.ViewPageTemplateFile"s. They are generally
attributes on a view class, though, so a method on the view might
pass arguments to the template (that are then available in 'options',
as you are familiar). However, since the template also has the view,
as you note below, you might not need to.
Now, I am getting along OK with Zope3. I understand
that the basic TAL namespaces available in a ZPT are
view, request and context.
As far as I can tell from documentation and examples,
POST requests are handled by the
Actually, no. The standard idiom is to self-post. The view class
(in __call__, at its most primitive level) is then responsible for
deciding what to draw. If you do an actual redirect (in Zope 2 and
Zope 3) then you are responsible for passing things around in the
query string, or the session, or an annotation, or what have you.
My problem with
this method is that it causes the instantiation of a
new view component, so I cannot hold state with the
Why do you need to redirect? Do you actually mean an HTTP redirect?
Or are you looking up a different view from within the first view's
__call__, and rendering it for the first view to return? Not sure
what you are doing.
I would be very grateful if anyone could tell me how I
can pass arguments to the rendered page template. I do
not wish to set attributes on the content/context
object as the form values from the POST request are
specific to the request. so I cannot hold state with
environments where cookies are disabled.
I tried searching the interface specification for
'request' to see if there was an analogue of the Zope2
request.setAttribute function, but could not find one.
It is possible to annotate the request, but you shouldn't have to for
this use case. That should be used sparingly.
Zope3-users mailing list