Ejemplo n.º 1
0
class ObjectField(BaseField):
    """A collection field.
    """
    implements(IObjectField)
    objectFactory = DEFAULT
    dataManager = ObjectDataManager

    def __init__(self, title, schema=None, **options):
        super(ObjectField, self).__init__(title, **options)
        self._schema = schema
        self._fields = Fields()
        if schema is not None:
            self._fields.extend(schema)

    @property
    def objectSchema(self):
        return self._schema

    @property
    def objectFields(self):
        return self._fields

    def getObjectFactory(self):
        if self.objectFactory is not DEFAULT:
            return self.objectFactory
        schema = self.objectSchema
        return getUtility(IFactory, name=schema.__identifier__)
Ejemplo n.º 2
0
 def __init__(self, title, schema=None, **options):
     super(ObjectField, self).__init__(title, **options)
     self._schema = schema
     self._fields = Fields()
     if schema is not None:
         self._fields.extend(schema)