示例#1
0
    def __init__(self, context, request, formfile):

        xmlff = XMLFormFactory(formfile.filename)

        form = xmlff.create_form(action="")

        FormView.__init__(self, context, request, form)
示例#2
0
    def __init__(self, context, request, formfile):

        xmlff = XMLFormFactory(formfile.filename)

        form = xmlff.create_form(action="")

        FormView.__init__(self, context, request, form)
示例#3
0
    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="")
示例#4
0
    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)
示例#5
0
    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)
示例#6
0
    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
示例#7
0
    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
示例#8
0
    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
示例#9
0
 def setup_class(self):
     xml = find_file('test_xml_form.xml', __file__)
     self.form = XMLFormFactory(xml).create_form()