def parse_schema(form):
    """
    Given an HTML form, parse out the schema defined in it and return
    that schema.
    """
    listener = SchemaBuilder()
    p = htmlfill.FillingParser(defaults={}, listener=listener)
    p.feed(form)
    p.close()
    return listener.schema()
예제 #2
0
 def render(self, defaults={}, errors={}, use_all_keys=False):
     if self.auto_insert_errors:
         auto_error_formatter = htmlfill.default_formatter
     else:
         auto_error_formatter = None
     p = htmlfill.FillingParser(defaults=defaults,
                                errors=errors,
                                use_all_keys=use_all_keys,
                                auto_error_formatter=auto_error_formatter)
     p.feed(self.form)
     p.close()
     return p.text()
예제 #3
0
 def parse_schema(self):
     listener = htmlfill_schemabuilder.SchemaBuilder()
     p = htmlfill.FillingParser(defaults={}, listener=listener)
     p.feed(self.form)
     p.close()
     return listener.schema()