durusmail: quixote-users: some newbie questions and comments
some newbie questions and comments
2003-11-20
2003-11-20
2003-11-20
2003-11-20
2003-11-21
2003-11-21
2003-11-23
2003-11-23
2003-11-22
2003-11-22
2003-11-23
2003-11-23
2003-11-22
some newbie questions and comments
Michael Watkins
2003-11-20
On Thu, 2003-11-20 at 10:58, George wrote:
> 2) How can one set style properties of widgets? I mean, let say, background,
font,
> border-styles, etc; where applicable.

I would like to vote for some changes in Form2 along these lines as
well.

One that I think should be in the standard class, since its simply valid
HTML, is .

I'm subclassing Form, WidgetRow etc (optionally) add some things like
HTML 4.01 tags fieldset and legend, which provides for a very nice
labelled border without resorting to any CSS styling.
Edit This Object
Minor change to Form: class Form... def __init__(self, name=None, method="post", action_url=None, enctype=None, use_tokens=True, legend=None): # optionally creates a nice HTML 4.01 driven labelled border self.legend = legend It would also be useful to be able to pass CSS styling info to Widgets as well as WidgetRow. I seem to recall some CSS discussion lately and will go back and re-read that in the archives. > 1) Could the widgets be designed so as to explicitly set their data sources obtained > from DBs? Now it seems to me sort of hard-coded. This seems to me something best left done for an individual developer to deal with by subclassing widgets. Otherwise, what DB access mechanism would you support? Python DBAPI is pretty low level, compared to what many Python - SQL developers work with - prefering some sort of Object Relational mapping such as Cucumber or ORM or others. And sometimes no RDBMS is involved at all - i.e. the use of an object "database" such as ZODB. You'll find that Quixote form objects work really well with either ZODB or the object-relational mappers. Imagine something like this: class DocType: bunch o attributes and methods def edit_form(): DOC_TYPES = db.make_catalog(DocType).fetchall() form.add(OptionSelectWidget, 'doc_type', title='Document Type',options=DOC_TYPES) ... ... if not form.is_submitted(): return render() # do something with what was submitted # NOTE that doc_type will contain an object instance, not just a # string from the forms select widget -- in this # made up example, a true blue object persisted in the database doc_type = form['doc_type'] ... Its pretty simple, and very powerful and useful. And also pretty different to most things I was used to on the Microsoft side... a little mind set change required. -- Mike Watkins mw@mikewatkins.net "Biology is the only science in which multiplication means the same thing as division."
reply