Check if field is on the object before checked if it is an selection

bzr revid: ced-0cb4862be7a5602527296e060750b5ea66bcb19b
This commit is contained in:
ced 2007-09-07 14:02:32 +00:00
parent 4c8f67388c
commit f41ea079a0
1 changed files with 6 additions and 2 deletions

View File

@ -986,7 +986,9 @@ class orm(object):
upd_todo.append(field)
else:
updend.append(field)
if hasattr(self._columns[field], 'selection') and vals[field]:
if field in self._columns \
and hasattr(self._columns[field], 'selection') \
and vals[field]:
if isinstance(self._columns[field], fields.reference):
val = vals[field].split(',')[0]
else:
@ -1116,7 +1118,9 @@ class orm(object):
upd2.append(self._columns[field]._symbol_set[1](vals[field]))
else:
upd_todo.append(field)
if hasattr(self._columns[field], 'selection') and vals[field]:
if field in self._columns \
and hasattr(self._columns[field], 'selection') \
and vals[field]:
if isinstance(self._columns[field], fields.reference):
val = vals[field].split(',')[0]
else: