durusmail: quixote-users: Re: Customization of Quixote2 "Form" appearence
Customization of Quixote2 "Form" appearence
2008-04-04
2008-04-04
2008-04-06
2008-04-06
Re: Customization of Quixote2 "Form" appearence
2008-04-05
2008-04-05
2008-04-07
Re: Customization of Quixote2 "Form" appearence
Neil Schemenauer
2008-04-04
Ian Forbes  wrote:
> Next I have sub-classed the "add" method as it classifies a "reset"
> widget as a normal widget and not a "submit widget". Which means it gets
> put with the input fields at the top of the form and not with the
> buttons at the bottom. Perhaps this could be regarded as a bug.

Yes, I would say so.  I guess we've never used ResetWidget (there
are some people who believe it's a UI flaw).  A simple fix would be
to make ResetWidget a subclass of SubmitWidget.  However, it would
seem more correct to render all ButtonWidget instances at the end of
the form.  That is a more complicated change and I'm afraid it would
break some people's code.  Any suggestions?

> But this is when things start to get ugly. The code in "form.py"
> contains direct imports for ResetWidget and SubmitWidget which picks up
> the original versions of these classes. So now it looks like I have to
> create my own customized copy of "form.py".
[...]
> What is the most elegant "pythonic" way out of this dilemma?

I've never been able to figure out a good solution to this mess.  I
believe multi-methods would be a possilbe way out.  Perhaps there
are some single-dispatch OO patterns that could be used to provide
the necessary flexibility but I don't know of them.

> Is there any active development being done on Quixote which might result
> in future changes to the Form object?

I'm planning to make some incompatible changes to make Quixote
forwards compatible to Python 3.  For example, unicode will have to
become the default string type rather than "str".  I'm also toying
with the idea of making use of some recent Python features like
decorators.

I'm torn in regard to making incompatible changes.  I think we
handled the 1.x to 2.x change poorly and lost a lot of community
momentum in the process.  OTOH, while the 2.x had a lot of nice
cleanups and flexibility improvements, I still feel like Quixote is
more complicated and less flexible than it could be.

> Has anybody used the "Form" object from quixote2 for anything except the
> basic pages, if so how did you go about it?

Yes.  Using CSS can get you pretty far.  If that doesn't do it,
using your own widget classes and/or Form subclass will do the
trick.  It's always good to re-use code but there really isn't that
much code in the form package.  Rolling your own customized version
is not a sin, IMHO.

Cheers,

  Neil

reply