def __init__(self, dbm, name=None, label=None, form_code=None, fields=None, entity_type=None, type=None, language="eng", state=attributes.ACTIVE_STATE): assert isinstance(dbm, DatabaseManager) assert name is None or is_not_empty(name) assert fields is None or is_sequence(fields) assert form_code is None or (is_string(form_code) and is_not_empty(form_code)) assert type is None or is_not_empty(type) assert entity_type is None or is_sequence(entity_type) DataObject.__init__(self, dbm) self._form_fields = [] self.errors = [] # Are we being constructed from scratch or existing doc? if name is None: return # Not made from existing doc, so build ourselves up self._form_fields = fields self.validate_fields() doc = FormModelDocument() doc.name = name doc.add_label(language, label) doc.form_code = form_code doc.entity_type = entity_type doc.type = type doc.state = state doc.active_languages = language DataObject._set_document(self, doc)
def _set_doc(self, form_code, is_registration_model, label, language, name): doc = FormModelDocument() doc.name = name doc.set_label(label) doc.form_code = form_code doc.active_languages = [language] doc.is_registration_model = is_registration_model DataObject._set_document(self, doc)