[Checkins] SVN: z3c.relationfield/trunk/ Ensure that the value_type of a RelationList is not overwritten to be 'None' when the field is constructed.
Martin Aspeli
optilude at gmx.net
Sun Oct 11 06:21:00 EDT 2009
Log message for revision 105008:
Ensure that the value_type of a RelationList is not overwritten to be 'None' when the field is constructed.
Changed:
U z3c.relationfield/trunk/CHANGES.txt
U z3c.relationfield/trunk/src/z3c/relationfield/schema.py
U z3c.relationfield/trunk/src/z3c/relationfield/tests.py
-=-
Modified: z3c.relationfield/trunk/CHANGES.txt
===================================================================
--- z3c.relationfield/trunk/CHANGES.txt 2009-10-11 10:17:15 UTC (rev 105007)
+++ z3c.relationfield/trunk/CHANGES.txt 2009-10-11 10:20:59 UTC (rev 105008)
@@ -1,8 +1,14 @@
CHANGES
*******
+0.6 (2009-10-08)
+================
+
+* Ensure that the value_type of a RelationList is not overwritten to be 'None'
+ when the field is constructed.
+
0.5 (2009-06-30)
-==================
+================
* Move lxml and schema2xml dependencies to an [xml] extra so that people can
use this package without having to install lxml, which still causes issues
Modified: z3c.relationfield/trunk/src/z3c/relationfield/schema.py
===================================================================
--- z3c.relationfield/trunk/src/z3c/relationfield/schema.py 2009-10-11 10:17:15 UTC (rev 105007)
+++ z3c.relationfield/trunk/src/z3c/relationfield/schema.py 2009-10-11 10:20:59 UTC (rev 105008)
@@ -9,7 +9,10 @@
class RelationList(List):
implements(IRelationList)
- value_type = Relation()
+ def __init__(self, value_type=None, unique=False, **kw):
+ if value_type is None:
+ value_type = Relation()
+ super(RelationList, self).__init__(value_type=value_type, unique=unique, **kw)
class RelationChoice(Choice):
implements(IRelationChoice)
\ No newline at end of file
Modified: z3c.relationfield/trunk/src/z3c/relationfield/tests.py
===================================================================
--- z3c.relationfield/trunk/src/z3c/relationfield/tests.py 2009-10-11 10:17:15 UTC (rev 105007)
+++ z3c.relationfield/trunk/src/z3c/relationfield/tests.py 2009-10-11 10:20:59 UTC (rev 105008)
@@ -7,9 +7,18 @@
MockContent,
)
from z3c.relationfield import event
+from z3c.relationfield import RelationList, Relation
from zope.component.interfaces import ObjectEvent
from zope.component.interfaces import ComponentLookupError
+class FieldTests(TestCase):
+ """Unit tests for fields
+ """
+
+ def test_list_value_type(self):
+ f = RelationList(title=u"Test")
+ self.failUnless(isinstance(f.value_type, Relation))
+
class EventTests(TestCase):
"""Unit tests for the relation field event handlers. The event handlers
should be tolerant of missing utilities and objects not yet registered with
@@ -65,4 +74,5 @@
def test_suite():
suite=TestSuite()
suite.addTest(makeSuite(EventTests))
+ suite.addTest(makeSuite(FieldTests))
return suite
More information about the checkins
mailing list