Permalink
Browse files

auto_add auto_add_now on save

  • Loading branch information...
1 parent 40c713d commit a8713e0487a6f8ed324c304d997f5e379e01414b @enki committed Jun 27, 2010
Showing with 4 additions and 3 deletions.
  1. +4 −3 tragedy/rows.py
View
@@ -194,15 +194,16 @@ def set_value_for_columnkey(self, column_key, value, dont_mark=False):
else:
self.markChanged(column_key)
- def listMissingColumns(self):
+ def listMissingColumns(self, for_saving=False):
missing_cols = OrderedSet()
for column_key, spec in self.column_spec.items():
value = self.column_values.get(column_key)
if spec.mandatory and (self.column_values.get(column_key) is None):
if spec.default:
default = spec.get_default()
- # self.set_value_for_columnkey(column_key, default)
+ if for_saving:
+ self.set_value_for_columnkey(column_key, default)
else: #if not hasattr(self, '_default_field'): # XXX: i think this was meant to check if self is an index?
missing_cols.add(column_key)
@@ -217,7 +218,7 @@ def isComplete(self):
def yield_column_key_value_pairs(self, for_saving=False, **kwargs):
access_mode = kwargs.pop('access_mode', 'to_identity')
- missing_cols = self.listMissingColumns()
+ missing_cols = self.listMissingColumns(for_saving=for_saving)
if for_saving and missing_cols:
raise TragedyException("Columns %s mandatory but missing." %
([(ck,self.column_spec[ck]) for ck in missing_cols],))

0 comments on commit a8713e0

Please sign in to comment.