コード例 #1
0
ファイル: object.py プロジェクト: thefunny42/Zeam-Form-ZTK
class ObjectField(Field):
    """A collection field.
    """
    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__)
コード例 #2
0
ファイル: object.py プロジェクト: thefunny42/Zeam-Form-ZTK
 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)