@action(default_option="<STR_LIT>", methods=("<STR_LIT:GET>", "<STR_LIT:POST>"), as_="<STR_LIT>")<EOL><INDENT>def form(self, obj=None, form=None, name=None, template=None, var_name=None, validate_on_submit=True,exit_on_failure=True, csrf_enabled=None):<DEDENT>
if not form or isinstance(form, str):<EOL><INDENT>if not name and isinstance(form, str):<EOL><INDENT>name = form<EOL><DEDENT>if not name:<EOL><INDENT>name = request.endpoint.rsplit('<STR_LIT:.>', <NUM_LIT:1>)[<NUM_LIT:1>] if '<STR_LIT:.>' in request.endpoint else request.endpoint<EOL><DEDENT>if name not in self.forms:<EOL><INDENT>raise NoFormError("<STR_LIT>" % name)<EOL><DEDENT>form = self.forms[name]<EOL><DEDENT>if inspect.isclass(form):<EOL><INDENT>if isinstance(obj, dict):<EOL><INDENT>obj = DictObject(obj)<EOL><DEDENT>if csrf_enabled is None:<EOL><INDENT>csrf_enabled = self.options["<STR_LIT>"]<EOL><DEDENT>form = form(obj=obj, meta={'<STR_LIT>': csrf_enabled})<EOL><DEDENT>current_context.data.form = form<EOL>yield form<EOL>if validate_on_submit and request.method == "<STR_LIT:POST>":<EOL><INDENT>self.validate(form, exit_on_failure=exit_on_failure)<EOL><DEDENT>
Loads a form and validates it (unless specified).
        If the form referenced has not been loaded, an attempt to create a form
        object using the information in the template will be made.