I noticed that PersistentList and PersistentDict do not satisfy
zope.schema.List or zope.schema.Dict, which is rather annoying.  For

class IBlogPost(Interface):
    tags = zope.schema.List(title=u'Tags', value_type=zope.schema.TextLine)

class BlogPost(Persistent):

    tags = FieldProperty(IBlogPost['tags'])

    def __init__(self):
        super(BlogPost, self).__init__()
        self.tags = persistent.list.PersistentList() #aaah, WrongType error...

will throw a WrongType: ([], <type 'list'>) error, which is especially
confusing because the repr for PersistentList makes it look an awful
lot like a regular list.

same thing happens with PersistentDict.

I would like to modify zope.schema._bootstrapfields by changing the
_type attribute of the List class to (list, UserList), and do the same
for Dict with (dict, UserDict).  Then anything inheriting from
UserList (including PersistentList) will satisfy the schema.

Can anyone think of a reason why this would be bad?

Paul Carduner
Zope-Dev maillist  -  Zope-Dev@zope.org
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to