Permalink
Browse files

Merge pull request #1 from sassur/master

Adds title and description from factory to schema
  • Loading branch information...
2 parents bd9bdbd + 86315ab commit 106b995618324a1ef63de0d222431ec13ac61516 @robinharms committed Feb 14, 2012
@@ -14,7 +14,11 @@ def createContent(factory_name, *args, **kwargs):
def createSchema(factory_name, **kwargs):
""" Create a colander schema object.
"""
- return getUtility(ISchemaFactory, factory_name)(**kwargs)
+ factory = getUtility(ISchemaFactory, factory_name)
+ schema = factory(**kwargs)
+ schema.title = factory.title
+ schema.decription = factory.description
+ return schema
def createField(factory_name, *args, **kwargs):
@@ -3,6 +3,6 @@
from betahaus.pyracont.decorators import schema_factory
-@schema_factory('DummySchema')
+@schema_factory('DummySchema', title=u"dummy schema title", description=u"dummy schema description")
class DummySchema(colander.Schema):
dummy_schema_node = colander.SchemaNode(colander.String())
@@ -65,6 +65,9 @@ def test_create_schema(self):
obj = self._fut('DummySchema')
#Note: Instantiated schemas are SchemaNodes themselves!
self.failUnless(isinstance(obj, colander.SchemaNode))
+ # check title and description
+ self.assertIsNotNone(obj.title)
+ self.assertIsNotNone(obj.decription)
class CreateFieldTests(TestCase):

0 comments on commit 106b995

Please sign in to comment.