[Zope3-checkins] SVN: Zope3/trunk/src/zwiki/ Old-style container constraints changed to contains/containers functions

Dmitry Vasiliev dima at hlabs.spb.ru
Mon Nov 7 10:20:11 EST 2005


Log message for revision 39959:
  Old-style container constraints changed to contains/containers functions
  

Changed:
  U   Zope3/trunk/src/zwiki/interfaces.py
  U   Zope3/trunk/src/zwiki/wikipage.py

-=-
Modified: Zope3/trunk/src/zwiki/interfaces.py
===================================================================
--- Zope3/trunk/src/zwiki/interfaces.py	2005-11-07 11:23:13 UTC (rev 39958)
+++ Zope3/trunk/src/zwiki/interfaces.py	2005-11-07 15:20:11 UTC (rev 39959)
@@ -20,11 +20,9 @@
 from zope.interface import Interface
 from zope.schema import TextLine, List, SourceText, Choice
 
-from zope.schema import Field
 from zope.app.container.interfaces import IContained
 from zope.app.container.interfaces import IContainer
-from zope.app.container.constraints import ContainerTypesConstraint
-from zope.app.container.constraints import ItemTypePrecondition
+from zope.app.container.constraints import contains, containers
 from zope.app.event.interfaces import IObjectEvent
 
 from zwiki import ZWikiMessageFactory as _
@@ -63,11 +61,8 @@
     (source) and the source type of the wiki page.
     """
 
-    def __setitem__(name, object):
-        """Add a comment object."""
+    contains(IComment)
 
-    __setitem__.precondition = ItemTypePrecondition(IComment)
-
     source = SourceText(
         title=_(u"Source Text"),
         description=_(u"Renderable source text of the Wiki Page."),
@@ -85,10 +80,10 @@
 class IWikiPageContained(IContained):
     """Objects that can be contained by Wiki Pages should implement this
     interface."""
-    __parent__ = Field(
-        constraint = ContainerTypesConstraint(IWikiPage))
 
+    containers(IWikiPage)
 
+
 class IWikiPageHierarchy(Interface):
     """This interface supports the virtual hierarchical structure of the Wiki
     Pages."""
@@ -126,18 +121,15 @@
 class IWiki(IContainer):
     """A simple container that manages Wikis inside itself."""
 
-    def __setitem__(name, object):
-        """Add a wiki page object."""
+    contains(IWikiPage)
 
-    __setitem__.precondition = ItemTypePrecondition(IWikiPage)
 
-
 class IWikiContained(IContained):
     """Objects that contain Wikis should implement this interface."""
-    __parent__ = Field(
-        constraint = ContainerTypesConstraint(IWiki))
 
+    containers(IWiki)
 
+
 class IWikiPageEditEvent(IObjectEvent):
     """An object event containing the old source in addition
     to the changed object

Modified: Zope3/trunk/src/zwiki/wikipage.py
===================================================================
--- Zope3/trunk/src/zwiki/wikipage.py	2005-11-07 11:23:13 UTC (rev 39958)
+++ Zope3/trunk/src/zwiki/wikipage.py	2005-11-07 15:20:11 UTC (rev 39959)
@@ -46,7 +46,7 @@
 SubscriberKey = 'http://www.zope.org/zwiki#1.0/MailSubscriptions/emails'
 
 
-class WikiPage(BTreeContainer, Contained):
+class WikiPage(BTreeContainer):
     """A persistent Wiki Page implementation."""
 
     implements(IWikiPage, IWikiContained)



More information about the Zope3-Checkins mailing list