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: if boolean_fields in node_attrs:
node_attrs[boolean_fields] = \ node_attrs[boolean_fields] = \
bool(int(node_attrs[boolean_fields])) bool(int(node_attrs[boolean_fields]))
if fname not in fields:
continue
fields[fname].update(node_attrs) fields[fname].update(node_attrs)
node_attrs.update(fields[fname]) node_attrs.update(fields[fname])
cell = CELLTYPES.get(fields[fname]['type'])(fname, treeview, cell = CELLTYPES.get(fields[fname]['type'])(fname, treeview,

View file

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