Commit de186149 authored by Laurent Bachelier's avatar Laurent Bachelier

Fix saving None into configs

parent 55a63ed4
......@@ -202,6 +202,11 @@ class CoreCleaner(ICleaner):
f.view = None
print "%s: fixed empty view." % f._get_confname()
for user in
if user.key in ["", "None"]:
user.key = None
print "%s: fixed empty key." % f._get_confname()
def gc(self):
for f in self.invalid_paths:
......@@ -201,7 +201,8 @@ class Storage(object):
for key, value in items.iteritems():
if isinstance(value, unicode):
value = value.encode('utf-8')
config.set(sec, key, value)
if value is not None:
config.set(sec, key, value)
with open(path, 'wb') as fp:
......@@ -84,3 +84,7 @@ class CleanupTest(TestCase):
assert['ass2m_test', 'cleanup', '--gc']) in (0, None)
output = self.endCapture()
assert output.strip() == 'files/3be00feb429b32b7705b689475e3ab8bdf16733f: fixed empty view.'
f ='/hello')
assert['info'].get('view') is None
assert f.view is None
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment