From: Zac Medico Date: Tue, 25 Sep 2012 01:54:32 +0000 (-0700) Subject: cache/sqlite.py: translate None to empty string X-Git-Tag: v2.2.0_alpha133~21 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f6aeb08c6aedeceee44b2dc65be60a5fd0474981;p=portage.git cache/sqlite.py: translate None to empty string --- 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