changeset 2148:d6d3ad2ee913

Merged thomaswaldmann/moin-2.0 into default
author ana-balica <ana.balica@gmail.com>
date Fri, 12 Jul 2013 21:09:08 +0300
parents da5db71646ab (current diff) 8370552b2450 (diff)
children 2e7e81a3133f
files
diffstat 2 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/items/__init__.py	Wed Jul 10 13:45:29 2013 +0300
+++ b/MoinMoin/items/__init__.py	Fri Jul 12 21:09:08 2013 +0300
@@ -396,6 +396,8 @@
 
     def modify(self, meta, data, comment=u'', contenttype_guessed=None, **update_meta):
         meta = dict(meta)  # we may get a read-only dict-like, copy it
+        # get rid of None values
+        update_meta = {key:value for key, value in update_meta.items() if value is not None}
         meta.update(update_meta)
         return self._save(meta, data, contenttype_guessed=contenttype_guessed, comment=comment)
 
--- a/MoinMoin/items/_tests/test_Item.py	Wed Jul 10 13:45:29 2013 +0300
+++ b/MoinMoin/items/_tests/test_Item.py	Fri Jul 12 21:09:08 2013 +0300
@@ -362,6 +362,7 @@
         update_meta = {
             'another_test_key': 'updated_test_value',
             'new_test_key': 'new_test_value',
+            'none_test_key': None,
         }
         item.modify(another_meta, another_data, **update_meta)
         item = Item.create(name)
@@ -369,6 +370,7 @@
         assert item.meta['test_key'] == another_meta['test_key']
         assert item.meta['another_test_key'] == update_meta['another_test_key']
         assert item.meta['new_test_key'] == update_meta['new_test_key']
+        assert 'none_test_key' not in item.meta
 
 
 coverage_modules = ['MoinMoin.items']