Using web2py version 1.79.2
In building a form using SQLFORM I use:
form = SQLFORM(db.table, record, fields=myfields, labels=mylabels,
col3=mycol3, deletable=True)
where mylabels and mycol3 use XML() to wrap some HTML markup
PROBLEM:
Works fine, except when I try to delete a record I get:
File "/home/bob/cdmc_site/web2py/applications/init/controllers/
trip.py", line 221, in edit
if form.accepts(request.vars, session):
File "/home/bob/cdmc_site/web2py/gluon/sqlhtml.py", line 930, in
accepts
for component in self.elements('input, select, textarea'):
File "/home/bob/cdmc_site/web2py/gluon/html.py", line 634, in
elements
subset = [self.elements(a,**kargs) for a in args]
File "/home/bob/cdmc_site/web2py/gluon/html.py", line 695, in
elements
child_matches = c.elements( *args, **kargs )
File "/home/bob/cdmc_site/web2py/gluon/html.py", line 695, in
elements
child_matches = c.elements( *args, **kargs )
File "/home/bob/cdmc_site/web2py/gluon/html.py", line 695, in
elements
child_matches = c.elements( *args, **kargs )
File "/home/bob/cdmc_site/web2py/gluon/html.py", line 695, in
elements
child_matches = c.elements( *args, **kargs )
AttributeError: 'XML' object has no attribute 'elements'
SOLUTION:
add a dummy 'elements' method to gluon.html.XML(XmlComponent):
def elements(self, *args, **kargs):
return []
CAVEAT:
While this works for me, perhaps it is a bit simplistic.