Martin Aspeli wrote:
I'm pretty sure the README.txt doctest of the schemaextender package covers how to do this. It's part of the schema mutation ("fiddling") functionality.

yes, but it's documented in a different way than the implementation on README.txt:

    class PageExtender(object):
        adapts(ATDocument)
        implements(ISchemaExtender)

        fields = [
            MyBooleanField("super_power",
            widget = BooleanWidget(
                label="This page has super powers")),
                ]

        def __init__(self, context):
             self.context = context

        def getFields(self):
             return self.fields

on the test you have things like this:

class SetSchemaOrderTests(unittest.TestCase):

    def testMoveFieldToOtherSchemata(self):
        schema=ManagedSchema()
        schema.addField(MockField("one", "one"))
        schema.addField(MockField("two", "two"))
        set_schema_order(schema, {"one" : [ "one", "two" ]})
        self.assertEqual(schema.getSchemataNames(), ["one"])
        self.assertEqual(schema._names, ["one", "two"])

so for me it's not clear if I have to use ManagedSchema() to get the schema and where do I have to put that code... just after the fields assignments?

saludos


_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to