[Zope] acquisition context within product method
Dieter Maurer
dieter at handshake.de
Fri Sep 24 15:14:26 EDT 2004
Richard Rosenberg wrote at 2004-9-22 23:07 +0000:
> ...
>I am working on creating a zope product that uses multiple DTML pages
>to gather information from the user before actually constructing the
>product class, sort of like a 'wizard' interface. I am pretty new to
>this, so please bear with me.
>
>The idea is that __init__.py exposes the appropriate DTML form for step
>1 in the process, as well as the relevant module level function, e.g.,
>
>def initialize(context):
> context.registerClass(module.class,
> permission="Add class_name",
> constructors=(module.Step1Form, module.Step1Func))
>
>Step1Func would then return another DTML page/form called Step2Form
>
>Step2Form gets more info from the user and calls Step2Func
>
>Step2Func processes the returned info and in turn returns StepFinalForm
>StepFinalForm calls StepFinalFunc which actually instantiates the class
>and does self._setObject and all of that good stuff.
You must declare all your "Step<i>{Form|Func}" as constructors
(like you did for "i==1"). This declarations makes them
available via the "product context" (where you are when you
are creating a new object in the standard way).
--
Dieter
More information about the Zope
mailing list