Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: Dev

zope.formlib - Overriding default widget attributes

 

 

Zope dev RSS feed   Index | Next | Previous | View Threaded


albl500 at york

Apr 12, 2012, 10:48 AM

Post #1 of 1 (114 views)
Permalink
zope.formlib - Overriding default widget attributes

Dear Zope Devs,

I'm trying to remove a couple of default attributes from the rendered version
of the schema.Text widget, namely cols and rows.

I tried overriding the widgets attributes with None, which didn't work. I then
found in renderTag, in zope.formlib-4.0.6-py2.7.egg/zope/formlib/widget.py:603
that if a value of one of the keyword arguments (**kw) is set to None, then
the value is set to the key, and a deprecation warning is issued. In my case,
this therefore produces HTML with attributes like cols="cols", and
rows="rows". I don't like that at all, as all my styles are defined in CSS and
jQuery, and this overrides them!

So, please can this be replaced with a `continue` flow statement instead??

Suggested patch:-

zope.formlib-4.0.6-py2.7.egg/formlib> diff widget.py widget.py.orig
600c600,602
< for key, value in sorted(kw.items()):
---
> items = kw.items()
> items.sort()
> for key, value in items:
602c604,611
< continue
---
> warnings.warn(
> "None was passed for attribute %r. Passing None "
> "as attribute values to renderTag is deprecated. "
> "Passing None as an attribute value will be disallowed "
> "starting in Zope 3.3."
> % key,
> DeprecationWarning, stacklevel=2)
> value = key

In fact, I'd also get rid of the `if kw:` line, as it seems unnecessary...

Cheers,
Alex

ps. Sorry if this is a duplicate. I think my original message got rejected as
I hadn't subscribed...

--
Alex Leach
Department of Biology
University of York
York YO10 5DD
United Kingdom
www: http://bioltfws1.york.ac.uk/~albl500
EMAIL DISCLAIMER: http://www.york.ac.uk/docs/disclaimer/email.htm
--
Alex Leach BSc. MRes.
Department of Biology
University of York
York YO10 5DD
United Kingdom
www: http://bioltfws1.york.ac.uk/~albl500
EMAIL DISCLAIMER: http://www.york.ac.uk/docs/disclaimer/email.htm
_______________________________________________
Zope-Dev maillist - Zope-Dev [at] zope
https://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
https://mail.zope.org/mailman/listinfo/zope-announce
https://mail.zope.org/mailman/listinfo/zope )

Zope dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.