Python embedded like PHP

Jon Ribbens jon+usenet at unequivocal.co.uk
Mon Apr 1 17:21:18 EST 2002


In article <23891c90.0203310820.60696fb1 at posting.google.com>, Paul Boddie wrote:
> Template systems typically don't address these issues, whereas
> stand-alone validation systems address the nature of the input data
> but not how such data is "described" to the browser (and thus to the
> user). A coordinated approach which unifies input, output, and
> validation seems to be the logical next step in any significantly big
> or complex application.

Ah, I see. I must admit I have never seen a web application where
the benefits this would provide would outweigh the extra complexities
it would entail. From an HTML point of view, the only two input
attributes which could be magically generated are 'size' and
'maxlength'. 'size' is more dependent on the form design than the
input requirements, and hence it is not appropriate to base this value
on the input type, and the benefits of automagically setting maxlength
would seem to be extremely minor.

>From a coding point of view, I would think the benefits are fairly
small too. In most applications I can think of, input data is usually
being looked up from rather than entered into a database. For example,
if the user enters a username the question is not normally "is this a
valid username?", but "is this an existing username?", so no input
validation is required. I guess the common exception is email
addresses.

The nearest jonpy gets to this sort of thing is MultiForm, a class
for creating multi-page input forms. It provides a 'check' method
which you override to validate the input data and produce appropriate
error messages.

Cheers


Jon



More information about the Python-list mailing list