Here is an example that gives me the IInputWidget errors when I use the contains/containers approach:

class ICRM(IContainer):
    """Just a blank container to hold customers."""

class ICustomer(IContainer,IContained):
    """A basic customer."""

    salesperson = Choice(
        title = _(u'Sales Person'),
description = _(u'The sales person responsible for this account.'),
        vocabulary = "Sales Person",

    supportperson = Choice(
        title = _(u'Support Person'),
description = _(u'The support person responsible for this account.'),
        vocabulary = "Support Person",

class IService(IContained):
    """A service provided by the company."""

    approveddate = Date(
        title=_(u"Approved Date(YYYY-MM-DD)"),
description=_(u"The date this service was approved by finance."),

class CRM(BTreeContainer):
    """Just a blank container to hold customers."""

class Customer(BTreeContainer):
    salesperson = u''
    supportperson = u''

class Service(BTreeContainer):
    approveddate = u''

On Jan 26, 2007, at 9:24 PM, Marius Gedminas wrote:

On Fri, Jan 26, 2007 at 07:48:36PM +0100, David Johnson wrote:
When setting up container/contained relationships, what is the proper
approach? Is it the approach outlined in Stephan's book with
IContainer, __setitem__, and preconditions?  Or is it "contains" and

contains() and containers() is a newer and prettier way to achieve the
same result.  It didn't exist when Stephan's book was written.

I have been having some problems and would be curious the definitive
approach.  The former is more complicated and so I find make lots of
coding errors.  The latter is simple but I find it causes strange
IInputWidget errors.

Could you show us some code?

Marius Gedminas
"Nuclear war can ruin your whole compile."
                -- Karl Lehenbauer
Zope3-users mailing list

Zope3-users mailing list

Reply via email to