[Zope-CMF] Validation during object creation

Dieter Maurer dieter@handshake.de
Tue, 9 Jul 2002 18:42:35 +0200


Geoff Davis writes:
 > Having to add an ExternalMethod factory to accompany every new type I create
 > doesn't seem very elegant.
This is not necessary:

  I once did it this way:

    *  the product class has a specialized constructor which
       does not call "_setObject" but only wraps the newly
       created object in the context of "self".
       It returns wrapped but temporary objects.

    *  The "create XXX" is mapped to a Python Script that
       calls the specialized constructor and then renders
       a ZPT via the temporary object.

       Inside the ZPT, the full infrastructure of the product
       class can be used.

    *  The start of the ZPT contains a

       <XXX tal:define="result	     here/action;...">

    *  "action" is a method of the product class, responsible for
       all kind of modifications of the instance: creation, deletion,
       editing. It is controlled by request variables for the
       respective operation.

I do no longer do it this way because my instances cannot
be described fully on a single form. Now, I use workflow
to identify and locate partial objects.


Dieter