meta language to define forms
alex23
wuwei23 at gmail.com
Fri Mar 28 02:37:18 EDT 2014
On 28/03/2014 6:56 AM, Sells, Fred wrote:
> The idea is to use a nice clean syntax like Python to define form content, then render it as HTML but only as a review tool for users, The actual rendering would go into a database to let a vendor's tool generate the form in a totally non-standard syntax that's really clunky.
>
> Class FyFormNumber001(GeneralForm):
> Section1 = Section(title="Enter Patient Vital Signs")
> Question1 = NumberQuestion(title="Enter pulse rate", format="%d3")
> Question2 = Dropdown(title="Enter current status")
> Question2.choices = [ (1, "Alive and Kicking"), (2, "Comatose"), (3, "Dead"), ...]
>
> Is there anything out there that would be close or do you have any suggestions.
Are you familiar with z3c.form?
https://pypi.python.org/pypi/z3c.form
Given that it's part of the Zope web framework, it's fairly heavily
geared towards working with HTTP requests, but it's quite possible to
only use the parts that want. For your requirement, you could probably
get a long way with using zope.schema for defining the forms, and then
customising some of the templates to render them appropriately. The
provided widgets are easily extensible, so adding support for the vendor
form syntax - possibly as additional templates alongside the HTML ones -
should be doable.
More information about the Python-list
mailing list