[Zope-dev] Python Product as DataSkin

Michael R. Bernstein webmaven@lvcm.com
Sun, 18 Feb 2001 22:47:36 -0800


"Phillip J. Eby" wrote:
> 
> At 09:49 PM 2/18/01 -0800, Michael R. Bernstein wrote:
> >
> >Ok, assuming that the 'normal' instantiation is either
> >solved or a non-issue, do I need to do anything special to
> >get the newItem() method to call my products manage_add
> >method?
> 
> newItem() will not do that.  A Rack's newItem() method always takes only an
> 'id' method.  You'll need a method on the object itself that can be given
> anything else you want to give it, which you'll call from a method you
> create on the specialist, e.g. a "myAdd" method that takes all four
> parameters and then does something like:
> 
> newObject = self.newItem(id)
> newObject.setup(extraParm1,extraParm2,...)
> return newObject

Hmm. So I need to refactor the 'manage_add' method inside
the python product into two methods, 'manage_add' which
would be used by the 'normal' object creation process and
that would also call a second 'setup' method which could be
called by the specialists 'myadd' method directly, bypassing
the 'manage_add' method entirely.

Is that correct?

Is there anything else I would need to change?

Thanks,

Michael Bernstein.