Ejemplo n.º 1
0
 def new(self,
         form_type,
         name,
         description=None,
         fields=None,
         layout=None,
         form_definition_current=None):
     """
     Return new FormDefinition.
     """
     assert form_type in self.form_types, 'Invalid FormDefinition type ( %s not in %s )' % (
         form_type, self.form_types.keys())
     assert name, 'FormDefinition requires a name'
     if description is None:
         description = ''
     if layout is None:
         layout = []
     if fields is None:
         fields = []
     # Create new FormDefinitionCurrent
     if form_definition_current is None:
         form_definition_current = FormDefinitionCurrent()
     rval = FormDefinition(name=name,
                           desc=description,
                           form_type=self.form_types[form_type],
                           form_definition_current=form_definition_current,
                           layout=layout,
                           fields=fields)
     form_definition_current.latest_form = rval
     return rval
Ejemplo n.º 2
0
 def new(self, form_type, name, description=None, fields=None, layout=None, form_definition_current=None):
     """
     Return new FormDefinition.
     """
     assert form_type in self.form_types, "Invalid FormDefinition type ( %s not in %s )" % (
         form_type,
         self.form_types.keys(),
     )
     assert name, "FormDefinition requires a name"
     if description is None:
         description = ""
     if layout is None:
         layout = []
     if fields is None:
         fields = []
     # Create new FormDefinitionCurrent
     if form_definition_current is None:
         form_definition_current = FormDefinitionCurrent()
     rval = FormDefinition(
         name=name,
         desc=description,
         form_type=self.form_types[form_type],
         form_definition_current=form_definition_current,
         layout=layout,
         fields=fields,
     )
     form_definition_current.latest_form = rval
     return rval