diff options
author | Rob Crittenden <rcritten@redhat.com> | 2015-04-08 16:13:55 -0400 |
---|---|---|
committer | Simo Sorce <simo@redhat.com> | 2015-04-10 10:41:09 -0400 |
commit | 348fcbcbaf5c686cdb077c9bed53ded95ad04b49 (patch) | |
tree | fa0e8b0890bb7a73ae62905e2b8fe614157a4e77 /ipsilon/util/data.py | |
parent | 130aaa056aac3d214afef4a43ddf6f948f5f0a8b (diff) | |
download | ipsilon-348fcbcbaf5c686cdb077c9bed53ded95ad04b49.tar.gz ipsilon-348fcbcbaf5c686cdb077c9bed53ded95ad04b49.tar.xz ipsilon-348fcbcbaf5c686cdb077c9bed53ded95ad04b49.zip |
The last allowed/mapping rule can be removed in SPs
If you created rule(s) in an SP for either allowed attributes or
attribute mapping there was no way to remove the last rule meaning
it could never go back to use the global defaults.
https://fedorahosted.org/ipsilon/ticket/25
Signed-off-by: Rob Crittenden <rcritten@redhat.com>
Reviewed-by: Simo Sorce <simo@redhat.com>
Diffstat (limited to 'ipsilon/util/data.py')
-rw-r--r-- | ipsilon/util/data.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ipsilon/util/data.py b/ipsilon/util/data.py index 72e7f96..b06f00c 100644 --- a/ipsilon/util/data.py +++ b/ipsilon/util/data.py @@ -377,10 +377,14 @@ class Store(Log): datum = data[uid] for name in datum: if name in curvals: - q.update({'value': datum[name]}, - {'uuid': uid, 'name': name}) + if datum[name] is None: + q.delete({'uuid': uid, 'name': name}) + else: + q.update({'value': datum[name]}, + {'uuid': uid, 'name': name}) else: - q.insert((uid, name, datum[name])) + if datum[name] is not None: + q.insert((uid, name, datum[name])) q.commit() except Exception, e: # pylint: disable=broad-except |