Be more tolerant to xml view errors

This commit is contained in:
ced 2007-12-23 22:27:06 +01:00
parent 11af36613e
commit 74b7407022
2 changed files with 11 additions and 8 deletions

View file

@ -65,6 +65,8 @@ class ParserTree(ParserInterface):
if boolean_fields in node_attrs:
node_attrs[boolean_fields] = \
bool(int(node_attrs[boolean_fields]))
if fname not in fields:
continue
fields[fname].update(node_attrs)
node_attrs.update(fields[fname])
cell = CELLTYPES.get(fields[fname]['type'])(fname, treeview,

View file

@ -90,14 +90,15 @@ class Parse(object):
if name in ('form','tree'):
self.title = attrs.get('string', self.title)
self.container.new(self.col)
elif name=='field':
val = attrs.get('select', False) \
or self.fields[str(attrs['name'])].get('select', False)
if val:
if int(val) <= 1:
self.add_widget(attrs, val)
else:
self.add_widget_end.append((attrs, val))
elif name == 'field':
if attrs['name'] in self.fields:
val = attrs.get('select', False) \
or self.fields[attrs['name']].get('select', False)
if val:
if int(val) <= 1:
self.add_widget(attrs, val)
else:
self.add_widget_end.append((attrs, val))
def add_widget(self, attrs, val):
ftype = attrs.get('widget', self.fields[str(attrs['name'])]['type'])