[Zope3-Users] Changing object type in Object field.

Stephan Richter srichter at cosmos.phy.tufts.edu
Wed Sep 6 05:42:31 EDT 2006

On Tuesday 04 July 2006 05:58, thealx at poczta.onet.pl wrote:
> *First question*: is this design (delegation to subobject implementing
> specific interface) reasonable, or in Zope I should do that other way?


> *Second question*: Can object implementing IDueDateDecider (inherited from
> IDecider) be used in decider field (which has specified schema=IDecider)?
> How to ensure that proper schema (i.e IDueDateDecider instead of IDecider)
> will be displayed in ObjectWidget?

Well, you would need to write a specialized interface for IMyObject, such as 

> *Third question*: What way would you suggest to allow web user dynamically
> 'switch' decider object in MyObject (i.e change a kind of decision, for
> example from IInactivityDecider to IDueDateDecider) - preferably using
> formlib-based view?

Sure. formlib works. You just have to implement a mechanism for adding 
different IDecider objects. In the ZMI this is a common use case. So 
basically what you want is a set of "IDeciderFactory" obejcts that are 
registered as utilities. You then select which factory you want to use. The 
factory can also provide the schema to use for the form.

Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training

More information about the Zope3-users mailing list