Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding title and description from decorator to schema

  • Loading branch information...
commit 86315ab3aac62d710216a380addcfa649bad1990 1 parent bd9bdbd
@sassur sassur authored
View
6 betahaus/pyracont/factories.py
@@ -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):
View
2  betahaus/pyracont/tests/fixtures/schemas.py
@@ -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())
View
3  betahaus/pyracont/tests/test_factories.py
@@ -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):
Please sign in to comment.
Something went wrong with that request. Please try again.