Author: jmorliaguet
Date: Thu May  4 21:26:39 2006
New Revision: 3042

Modified:
   cpsskins/branches/paris-sprint-2006/relations/interfaces.py
   cpsskins/branches/paris-sprint-2006/relations/relations.py

Log:

- optimizations / fixed the IRelation spec (missing __str__())



Modified: cpsskins/branches/paris-sprint-2006/relations/interfaces.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/relations/interfaces.py (original)
+++ cpsskins/branches/paris-sprint-2006/relations/interfaces.py Thu May  4 
21:26:39 2006
@@ -18,7 +18,7 @@
 __docformat__ = "reStructuredText"
 
 from zope.app.container.constraints import contains
-from zope.interface import Interface
+from zope.interface import Interface, Attribute
 
 from cpsskins.storage.interfaces import IStorage
 
@@ -53,17 +53,12 @@
     def __iter__():
         """Iterate through all relates."""
 
-    def getPredicate():
-        """Get the predicate of the relation."""
-
-    def setPredicate(predicate):
-        """Set the predicate od the relation."""
+    def __str__():
+        """Return the string representation of the relation's predicate"""
 
-    def getRelates():
-        """Get the relates."""
+    predicate = Attribute(u"The relation predicate")
 
-    def setRelates(relates):
-        """Set the relates."""
+    relates = Attribute(u"The relates")
 
 class IMonadicRelation(IRelation):
     """A monadic relation connects a relate with itself."""

Modified: cpsskins/branches/paris-sprint-2006/relations/relations.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/relations/relations.py  (original)
+++ cpsskins/branches/paris-sprint-2006/relations/relations.py  Thu May  4 
21:26:39 2006
@@ -47,7 +47,7 @@
         return self._tuple
 
     def __iter__(self):
-        return iter(self.values())
+        return iter(self._tuple)
 
     def __getitem__(self, k):
         return self._tuple[k]
@@ -63,10 +63,10 @@
             raise IOError("Cannot set the predicate of a stored relation.")
         if not isinstance(predicate, basestring):
             raise TypeError("The predicate must be a string.")
-        self._predicate = Predicate(unicode(predicate))
+        self._predicate = trusted(Predicate(unicode(predicate)))
 
     def getRelates(self):
-        return self._relates
+        return self._tuple
 
     def setRelates(self, relates):
         if IContained.providedBy(self):
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to