From f6aeb08c6aedeceee44b2dc65be60a5fd0474981 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 24 Sep 2012 18:54:32 -0700 Subject: [PATCH] cache/sqlite.py: translate None to empty string --- pym/portage/cache/sqlite.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pym/portage/cache/sqlite.py b/pym/portage/cache/sqlite.py index 1038bb2ab..9c1b3eb7e 100644 --- a/pym/portage/cache/sqlite.py +++ b/pym/portage/cache/sqlite.py @@ -21,7 +21,7 @@ class database(fs_template.FsBased): # to calculate the number of pages requested, according to the following # equation: cache_bytes = page_bytes * page_count cache_bytes = 1024 * 1024 * 10 - _db_table = None + _EMPTY_STRING = _unicode_decode("") def __init__(self, *args, **config): super(database, self).__init__(*args, **config) @@ -206,12 +206,17 @@ class database(fs_template.FsBased): raise KeyError(cpv) else: raise cache_errors.CacheCorruption(cpv, "key is not unique") + result = result[0] d = {} allowed_keys_set = self._allowed_keys_set for column_index, column_info in enumerate(cursor.description): k = column_info[0] if k in allowed_keys_set: - d[k] = result[0][column_index] + v = result[column_index] + if v is None: + # This happens after a new empty column has been added. + v = self._EMPTY_STRING + d[k] = v return d -- 2.26.2