Mike Orr
2009-04-09 19:04:39 UTC
At PyCon Ian mentioned he's looking for a maintainer for FormEncode.
I don't have time to do this right now but I may in a few months. In
the meantime I'd like to start a discussion on what direction
FormEncode should go.
- The manual is incomplete, both in terms of how to use FormEncode
under a web framework, and many validators are undocumented. Ian and
I made a list of things to include:
http://wiki.pylonshq.com/display/pylonscookbook/The+other+FormEncode+manual+(UNFINISHED)
- Are there any features missing in the validators?
- Are there any features missing in htmlfill?
- Are there unused dead ends we can delete? Some of the anemic
validators like Constant, MaxLength, MinLength, Empty, and NotEmpty
aren't really useful alone because the user would typically want to do
more than just these. not_empty is now an attribute of
FancyValidator, for instance. MinLength, MaxLength, and Regex could
likewise be attributes of FancyValidator (with None to skip those
tests).
- OneOf, DictConverter, ListConverter, and Set are confusing because
they use Python data types differently than expected. For instance,
OneOf is what you normally do with a list (make sure the entered value
is in the list). And Set you would think is for working with sets,
but it isn't, it's a multiple-value control (akin to a MultiDict
value). I would somehow group the validators between the universal
ones everybody should know vs the specialized ones.
- Are there any API changes that would make it more useful or convenient?
- What about wrapper functions, along the lines of Pylons' @validate.
Are there any that would make FormEncode more useful in web
applications?
- FormEncode and htmlfill could be merged into WebHelpers since they
are often used together. That would also solve the problem of "Why is
FormEncode called FormEncode when it does validation rather than
encoding?" and "Why is htmlfill part of FormEncode when it doesn't do
validation?" I'm not sure if the ToscaWidgets developers would like
this though since I think they use the validators alone.
- The validators are also useful outside forms, for instance to
validate configuration files. But the error messages are not quite
ideal for that since they don't show the filename and line number of
the error. Maybe this could be added somehow.
I don't have time to do this right now but I may in a few months. In
the meantime I'd like to start a discussion on what direction
FormEncode should go.
- The manual is incomplete, both in terms of how to use FormEncode
under a web framework, and many validators are undocumented. Ian and
I made a list of things to include:
http://wiki.pylonshq.com/display/pylonscookbook/The+other+FormEncode+manual+(UNFINISHED)
- Are there any features missing in the validators?
- Are there any features missing in htmlfill?
- Are there unused dead ends we can delete? Some of the anemic
validators like Constant, MaxLength, MinLength, Empty, and NotEmpty
aren't really useful alone because the user would typically want to do
more than just these. not_empty is now an attribute of
FancyValidator, for instance. MinLength, MaxLength, and Regex could
likewise be attributes of FancyValidator (with None to skip those
tests).
- OneOf, DictConverter, ListConverter, and Set are confusing because
they use Python data types differently than expected. For instance,
OneOf is what you normally do with a list (make sure the entered value
is in the list). And Set you would think is for working with sets,
but it isn't, it's a multiple-value control (akin to a MultiDict
value). I would somehow group the validators between the universal
ones everybody should know vs the specialized ones.
- Are there any API changes that would make it more useful or convenient?
- What about wrapper functions, along the lines of Pylons' @validate.
Are there any that would make FormEncode more useful in web
applications?
- FormEncode and htmlfill could be merged into WebHelpers since they
are often used together. That would also solve the problem of "Why is
FormEncode called FormEncode when it does validation rather than
encoding?" and "Why is htmlfill part of FormEncode when it doesn't do
validation?" I'm not sure if the ToscaWidgets developers would like
this though since I think they use the validators alone.
- The validators are also useful outside forms, for instance to
validate configuration files. But the error messages are not quite
ideal for that since they don't show the filename and line number of
the error. Maybe this could be added somehow.
--
Mike Orr <***@gmail.com>
Mike Orr <***@gmail.com>