hi

I'm filling my form using the following:

form.fill(source=db.select('configuration')[0])

but when it is rendered any fields with a zero value in the database
are rendered as blank. Looking through the code in form.py it looks
like the following code is the culprit:

def render(self):
  attrs = self.attrs.copy()
  attrs['type'] = self.get_type()
  if self.value:
    attrs['value'] = self.value
  attrs['name'] = self.name
  return '<input %s/>' % attrs

I suspect that the if statement would be better phrased as:

  if self.value is not None:
    attrs['value'] = self.value

As select is returning a typed collection my zeros are coming into
render as integers and the if is interpreting them as False and hence
missing them out.

I'm new to web.py and may have miss understood the problem or maybe I
shouldn't be filling the form straight from the database.

Andy

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to