def __init__(self, context, request, formfile): xmlff = XMLFormFactory(formfile.filename) form = xmlff.create_form(action="") FormView.__init__(self, context, request, form)
def createForm(self, form_name=None): form_path = os.path.join( os.path.dirname(inspect.getfile(self.context.__class__)), "..", "forms", "%s.xml" % (form_name or self.context.content_type)) xmlff = BaseXMLFormFactory(form_path) return xmlff.create_form(action="")
def __init__(self, context, request, formfile, retrieve_data=True, defaults=None): if hasattr(formfile, "filename"): xmlff = XMLFormFactory(formfile.filename) else: xmlff = XMLFormFactory(formfile) form = xmlff.create_form(action="") formview.__init__(self, context, request, form, retrieve_data=retrieve_data, defaults=defaults)
def __init__(self, context, request, formfile, retrieve_data=True, defaults=None): if hasattr(formfile, 'filename'): xmlff = XMLFormFactory(formfile.filename) else: xmlff = XMLFormFactory(formfile) form = xmlff.create_form(action="") formview.__init__(self, context, request, form, retrieve_data=retrieve_data, defaults=defaults)
def __form__(self, request): """ Volatile form """ try: return self._v_form except: form = find_file(self.edit_form, self.__class__) xmlff = XMLFormFactory(FormFile(form).filename) self._v_form = xmlff.create_form(action="") return self._v_form
def get_form(self): """ Get the form and form content """ # TODO: move the XML form creation out of this class form_file = FormFile(self.form_xml) xml_ff = XMLFormFactory(form_file.filename) form = xml_ff.create_form(action="") form_context = self.form_context # We may have data already... try: form.data = form.submission.retrieve(form, form_context) except: for key in form_context.formdefaults.keys(): try: form.data.getField(key).value = \ form_context.formdefaults[key] except: pass return form
def setup_class(self): xml = find_file('test_xml_form.xml', __file__) self.form = XMLFormFactory(xml).create_form()