From d4d7a47b09bf7056f0d0820ae86199b79ac7fd94 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Sun, 19 Jan 2014 10:47:21 +0100 Subject: [PATCH] do not ignore value if equal to default on saving, but only in check on empty row --- composer/schema/grid/field.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/composer/schema/grid/field.py b/composer/schema/grid/field.py index 32b101e..7b71014 100644 --- a/composer/schema/grid/field.py +++ b/composer/schema/grid/field.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2013 Helmut Merz helmutm@cy55.de +# Copyright (c) 2014 Helmut Merz helmutm@cy55.de # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -122,6 +122,8 @@ class GridFieldInstance(ListFieldInstance): def unmarshallRow(self, row, idx=None): item = {} cardinality = getattr(self.context, 'cardinality', None) + ignoreInCheckOnEmpty = list( + getattr(self.context, 'ignoreInCheckOnEmpty', [])) for fi in self.columnFieldInstances: if idx is not None: fi.index = idx @@ -133,10 +135,9 @@ class GridFieldInstance(ListFieldInstance): else: if fi.default is not None: if value == fi.default: - continue + ignoreInCheckOnEmpty.append(fi.name) if value: item[fi.name] = value - ignoreInCheckOnEmpty = getattr(self.context, 'ignoreInCheckOnEmpty', []) for k, v in item.items(): if k not in ignoreInCheckOnEmpty: #and v != '__no_change__': return item