[Twisted-web] Re: maxlength input with formless

Andrea Arcangeli andrea at cpushare.com
Fri Dec 10 12:02:29 MST 2004


On Thu, Dec 09, 2004 at 09:40:26AM -0500, Alex Levy wrote:
> Besides, I think most people here can agree that it's dangerous to allow
> people to mesh logic and presentation the way you can in languages like
> PHP or JSP; it results in badly-designed web applications, and it isn't
> quite the itch that Nevow was designed to scratch.

I didn't mean to necessairly use the syntax I shown, I agree it was
quite ugly ;). It was meant mostly to explain the problem in a clear
way. I was just wondering if there was a way to avoid this code
duplication.

	if maxlength < 0:
		.. input(...)
	else:
		.. input(... maxlength=maxlength ...)	

But I might have found how to avoid the above by __calling__ the
internal object with maxlength=maxlength conditionally to maxlength >= 0
(very similar concept of ctx.tag(something=something), it shouldn't
clear the previous contents).



More information about the Twisted-web mailing list