[Zope-dev] [Zope3-Users] Next Step to Bug Resolution???

Carsten Senger senger at rehfisch.de
Sun Jan 18 11:23:45 EST 2009


Tim Cook schrieb:

> class DataStructure(Persistence):
>    """abstract class"""

A typo? Do you use persistent.Persistent?

> 
> class ItemStructure(DataStructure):
>     """abstract class"""

 From your description you should define interfaces for 
Item-/DataStructure, IItem/IDataStructure(Interface), that describe the 
interfaces the classes implement. The interaces these base classes 
implement are automatically implemented by their subclasses.

> class ItemList(ItemStructure):
>     u"""
>     Logical list data structure, where each item has a value and can be
> referred to by a name 
>     and a positional index in the list. The list may be empty.
>     """
> 
>     items = List(
>         value_type=Object(schema=IElement),
>         title=_(u"items"),
>         description=_(u"""Physical representation of the list."""),
>         required=False
>     )

# Did not look at the Object-Part as I don't use that, but afaik you
# need to store objects that provide IElement (instances of classes that
# implement IElement).

class IItemList(Interface):
     '''describe that IItemLists have an attribute items that is a list.
     items = List(
         value_type=Object(schema=IElement),
         title=_(u"items"),
         description=_(u"""Physical representation of the list."""),
         required=False
     )

from persistent.list import PersistentList

class ItemList(ItemStructure):
     '''fullfill the interface. Have an attribute items that is a list'''
     implements(IItemsList)

     items = PersistentList()

Forms validate based on the schema (interface). But maybe you want to 
use FieldProperty also validate if the attribute is written from other 
python cold.

All other classes have to do the same: Interface + implementation class


..Carsten



More information about the Zope-Dev mailing list