[Zope] two birds with one stone: modify objstate+redisplay

hans hans@beehive.de
Wed, 22 Aug 2001 15:23:55 +0100


let P be a product (python), with instance PI.
In product code:

class P(SimpleItem):
    ...
    aForm=DTMLFile('aForm', globals())
    ...
    def m(..., REQUEST=None):
         """modify inner state of PI"""
         ...
         if REQUEST is not None:     # called via web
             return ??? # where-m-was-called-from,
                        # redisplay w different state of PI

In File aForm.dtml which displays PI's state:

... <a href="m?...">xxx</a>

In order to return from m(...) and redisplay PI's state,
usually (eg http://www.zope.org/Members/maxm/HowTo/minimal_01)
one writes
             return self.aForm(self)
However,
i want to call m from several different forms,
ultimately some user i dont know
will use DTML-Document i dont know,
to use it in his own software.
HOW-TO with one mouse-click
a) effect call of m (preferably via href)
b) effect redisplay of the DTML-document

i tried redirect(HTTP_REFERER), (well, i've several calls of m, urls get
mangled, one m( ) is delete!!)
additional parameter m( ..., url) fed with
a)<dtml-var URL0>   inside product code gives url just called, not just
displayed
b)<dtml-var absolute_url url_quote>  just gives .../PI, not .../PI/aForm