I am starting to use Dexterity and I have run into a couple of issues.  I
have created a content schema (in client.py) and defined a sub-object in it
like so:
    
    emails = schema.List(
            title=_(u"Email Addresses"),
            value_type = schema.Object(title=u'Emails',
                                       schema=IEmailSubObject),
            required=False,
        )
I then created email.py with the following:

@grok.provider(IContextSourceBinder)
def emailTypes(context):
    
    terms = []
    
    pprop = getToolByName(context, 'portal_properties')
    for t in pprop.client_properties.email_types:
        terms.append(SimpleVocabulary.createTerm(t, str(t), t))
    return SimpleVocabulary(terms)

class IEmailSubObject(Interface):
    email_type = schema.Choice(
            title=_(u"Email type"),
            source=emailTypes,
            required=True,
        )
    email_address = schema.TextLine(
        title=_(u"Email address"),
        required=True,
        )
This gives me an error "TypeError: iterable argument required".
Debuging shows that we pass through  zope.schema._field three times and the
third time the self.vocabulary is no longer a vocabulary! This seems similar
to the bug (340416) Martin reported on zope3.
If I change "email_type = schema.Choice(" to "email_type = schema.TextLine("
(and remove "source=emailTypes,") I get a generic error which seems to be
caused by the fact that IEmailSubObject is returning a list rather than an
object.

Am I missing something or am I trying to do something with Dexterity that it
is not ready for?

Allen
-- 
View this message in context: 
http://n2.nabble.com/Dexterity-sub-objects-issues-tp4469111p4469111.html
Sent from the Product Developers mailing list archive at Nabble.com.

_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to