[albatross-users] Bug with persistentlists and such (1.10)
Tollef Fog Heen
tfheen at raw.no
Mon Nov 10 10:34:59 EST 2003
(please Cc me, I'm not on the list)
It seems like checkbox_to_html in 1.10 has a bug if you try to give it
something which isn't a python list (but looks, walks and talks like
one). IMHO, a better way to test for whether this is a list is just
to try to use map, and if that fails, use str on the value itself; see
below.
def checkbox_to_html(self, ctx):
self.write_attribs_except(ctx, 'value', 'checked')
name, value, value_attr = self.get_name_value_checked(ctx, 'on')
if value and self.has_attrib('treeselect'):
value = 'on'
ctx.write_content(' name="%s"' % name)
ctx.write_content(' value="%s"' % value_attr)
try:
if str(value_attr) in map(str, value):
ctx.write_content(' checked')
except TypeError:
if str(value) and str(value) == str(value_attr):
ctx.write_content(' checked')
if not self.has_attrib('disabled'):
ctx.input_add('checkbox', name, value_attr, self.has_attrib('list')\
)
--
Tollef Fog Heen ,''`.
UNIX is user friendly, it's just picky about who its friends are : :' :
`. `'
`-
More information about the Albatross-users
mailing list