On Mon, 2008-07-07 at 00:46 +0200, Philipp von Weitershausen wrote:

> 
>    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).

Thanks Philipp.

Field doesn't work because it expects a unicode type.

Attribute works but I would like to be able to flag it as 'required'
which is not part of the Attribute class.

Object would work if it would allow types that subclass from the schema
given.

A concrete example:

IItemStructure(Interface)
   IItemTree(IItemStructure)
   IItemTable(IItemStructure)
   ...

ItemTree(ItemStructure)
  implements(IItemTree)

ItemTable(ItemStructure)
  implements(IItemTable)

...

Now I want to allow description to be any descendant of ItemStructure.
So I had hoped that:

    description=Object(
        schema=IItemStructure,
        title=_(u"Description"),
        description=_(u"Description of the activity."),
        required=True,
    )
  
would provide that functionality.  It still throws a WrongTypeError.

I feel like the answer lies somewhere in the zope.interface.implement*
functions but I lack the Zen to get the right combination.

Thanks,
Tim
             






-- 
Timothy Cook, MSc
Health Informatics Research & Development Services
LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook 
Skype ID == timothy.cook 
**************************************************************
*You may get my Public GPG key from  popular keyservers or   *
*from this link http://timothywayne.cook.googlepages.com/home*
**************************************************************

Attachment: signature.asc
Description: This is a digitally signed message part

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

Reply via email to