Tim Cook wrote:
I have a class attribute defined in an interface as such:

    description=Object(
        title=_(u"Description"),
        description=_(u"Description of the activity."),
        required=True,
    )

I used Object because this attribute can be one of several different
class instances.
But I get an error:
TypeError: __init__() takes exactly 2 non-keyword arguments (1 given)

Right. This is the typical error you get in Python when you're omitting a required parameter from a function or method call. In this case, the required parameter is 'schema':

  description=Object(
      schema=IFoo,
      ...
      )

So the zope.schema.Object field is really about specifying objects that provide a certain schema. It's not for *arbitrary* objects (use zope.schema.Field or zope.interface.Attribute here).

_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users

Reply via email to