[Checkins] SVN: z3c.relationfield/trunk/ There is no need for a IRelationInfo adapter - this only puts a bothersome
Martijn Faassen
faassen at infrae.com
Tue Dec 16 14:01:58 EST 2008
Log message for revision 94129:
There is no need for a IRelationInfo adapter - this only puts a bothersome
requirement on the implementer.
Changed:
U z3c.relationfield/trunk/CHANGES.txt
U z3c.relationfield/trunk/src/z3c/relationfield/__init__.py
U z3c.relationfield/trunk/src/z3c/relationfield/interfaces.py
U z3c.relationfield/trunk/src/z3c/relationfield/relation.py
-=-
Modified: z3c.relationfield/trunk/CHANGES.txt
===================================================================
--- z3c.relationfield/trunk/CHANGES.txt 2008-12-16 16:23:50 UTC (rev 94128)
+++ z3c.relationfield/trunk/CHANGES.txt 2008-12-16 19:01:58 UTC (rev 94129)
@@ -8,6 +8,9 @@
maintain a list of ``RelationValue`` objects that will be cataloged
like the regular ``Relation`` fields.
+* Get rid of IRelationInfo adapter requirement. Just define a
+ ``create_relation`` function that does the same work.
+
0.1 (2008-12-05)
================
Modified: z3c.relationfield/trunk/src/z3c/relationfield/__init__.py
===================================================================
--- z3c.relationfield/trunk/src/z3c/relationfield/__init__.py 2008-12-16 16:23:50 UTC (rev 94128)
+++ z3c.relationfield/trunk/src/z3c/relationfield/__init__.py 2008-12-16 19:01:58 UTC (rev 94129)
@@ -1,4 +1,6 @@
-from z3c.relationfield.relation import RelationValue, TemporaryRelationValue
+from z3c.relationfield.relation import (RelationValue,
+ TemporaryRelationValue,
+ create_relation)
from z3c.relationfield.index import RelationCatalog
from z3c.relationfield.schema import Relation, RelationList
from z3c.relationfield.event import realize_relations
Modified: z3c.relationfield/trunk/src/z3c/relationfield/interfaces.py
===================================================================
--- z3c.relationfield/trunk/src/z3c/relationfield/interfaces.py 2008-12-16 16:23:50 UTC (rev 94128)
+++ z3c.relationfield/trunk/src/z3c/relationfield/interfaces.py 2008-12-16 19:01:58 UTC (rev 94129)
@@ -60,14 +60,3 @@
Returns real relation object
"""
-
-
-class IRelationInfo(Interface):
- """Relationship information for an object.
- """
-
- def createRelation():
- """Create a relation object pointing to this object.
-
- Returns an object that provides IRelation.
- """
Modified: z3c.relationfield/trunk/src/z3c/relationfield/relation.py
===================================================================
--- z3c.relationfield/trunk/src/z3c/relationfield/relation.py 2008-12-16 16:23:50 UTC (rev 94128)
+++ z3c.relationfield/trunk/src/z3c/relationfield/relation.py 2008-12-16 19:01:58 UTC (rev 94129)
@@ -8,8 +8,7 @@
from z3c.objpath.interfaces import IObjectPath
from z3c.relationfield.interfaces import (IRelationValue,
- ITemporaryRelationValue,
- IRelationInfo)
+ ITemporaryRelationValue)
class RelationValue(Persistent):
implements(IRelationValue)
@@ -97,10 +96,6 @@
def _interfaces_flattened(interfaces):
return Declaration(*interfaces).flattened()
-class RelationInfoBase(grok.Adapter):
- grok.baseclass()
- grok.provides(IRelationInfo)
-
- def createRelation(self):
- intids = component.getUtility(IIntIds)
- return RelationValue(intids.getId(self.context))
+def create_relation(obj):
+ intids = component.getUtility(IIntIds)
+ return RelationValue(intids.getId(obj))
More information about the Checkins
mailing list