[Twisted-web] Formless disabling widget

Suha Onay suha at likyabilisim.com
Thu Jan 26 01:53:54 MST 2006


Changing annotate.py and adding a "disabled" attribute, as you said,
is not the best solution. Also writing custom render methods is lots of work
and error prone. The best way I think is adding custom attributes to '
custom_attributes dictionary is a good solution. By this way adding any
attribute is easy.
But since it should be done at nevow level, I will prefer writing custom
render methods
to the needed widgets.

Thanks for all your help.


As far as I know, it is impossible to add custom attributes without
> writing your own renderer. This is unfortunate because it means you
> can end up with a bunch of very similar rendering classes. (Although
> if you look at what happens to keyword arguments in annotate.Typed,
> you'll see it'd be reasonably easy to pass in custom attribute
> arguments and access them in your custom renderer).
> An alternative, if you don't mind running with a customized formless,
> is altering annotate.py so that your Typed accepts a "disabled"
> argument. You could then alter webform.py so the TypedRenderers there
> check this value and if appropriate add the attribute in.
> This isn't a brilliant solution either though, as I can't see a
> reasonable way to do this in one place for all of the
> TypedRenderers. You'd need to alter each of them that you wanted to be
> able to use the attribute. Of course, when you decide to add another
> custom attribute, you need to do the same all over again. :)
> Perhaps it would be nice if formless had a way for you to tell it to
> add particular attributes... a custom_attributes dictionary to
> annotate.Typed for instance. It'd be very handy in situations like
> this, but could be abused to go against formless's idea of seperating
> the argument types from the way they're rendered. Comments on this
> would be appreciated.
> Cheers and hope this helps,
> Steven Holmes
> _______________________________________________
> Twisted-web mailing list
> Twisted-web at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web



Likya Yazılım ve Bilişim Hizmetleri Ltd.Şti.
Kosgeb Teknoloji Geliştirme Merkezi
ODTÜ Teknokent No:219
06531 Ankara - TÜRKİYE
Tel :: (312) 210 13 00-217
Fax :: (312) 210 13 09
Web ::  www.likyabilisim.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-web/attachments/20060126/0ab5aef5/attachment.htm

More information about the Twisted-web mailing list