Python embedded like PHP

Paul Boddie paul at boddie.net
Tue Apr 2 03:47:14 EST 2002


Jon Ribbens <jon+usenet at unequivocal.co.uk> wrote in message news:<slrnaahnai.i1t.jon+usenet at snowy.squish.net>...
> 
> 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.

I think it depends a fair amount on the application. I've worked with
"form-heavy" applications myself, and it's not exactly a secret that
database-driven applications often have their presentation determined
by the underlying database schema.

> 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.

Yes, I probably got confused between "length" and "size" - I always
need to refer to the HTML specification in that case. Still, I
wouldn't underestimate the benefit of making sure that even such
simple properties are synchronised at all levels of an application.

> 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.

Some common validation cases are numbers, dates and monetary amounts,
and I've also seen systems which validated measurements. To an extent,
one can break down complicated fields into collections of simpler
ones, although some people dislike such interfaces. Nevertheless,
being able to declaratively associate form fields with the means of
validation, without the explicit need to code it, could well be
beneficial, in my opinion.

> 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.

That's another area where automation gives some notable advantages,
too.

Paul



More information about the Python-list mailing list