summaryrefslogtreecommitdiffstats
path: root/lib/bb/persist_data.py
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2011-04-04 09:37:07 -0700
committerChris Larson <chris_larson@mentor.com>2011-04-05 17:21:48 -0700
commit28958cd55e592853c68f5f2ba79381d1b8dcfb8f (patch)
tree3f6a46164deda93d8957a424d6dc17e0a2ae8d3e /lib/bb/persist_data.py
parent7942833ca0685cf4f3b243dde6203499ef97420c (diff)
downloadbitbake-contrib-28958cd55e592853c68f5f2ba79381d1b8dcfb8f.tar.gz
persist_data: don't allow non-string keys/values
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'lib/bb/persist_data.py')
-rw-r--r--lib/bb/persist_data.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/bb/persist_data.py b/lib/bb/persist_data.py
index baade7c4f..aa2ede4b9 100644
--- a/lib/bb/persist_data.py
+++ b/lib/bb/persist_data.py
@@ -68,6 +68,11 @@ class SQLTable(collections.MutableMapping):
self._execute("DELETE from %s where key=?;" % self.table, [key])
def __setitem__(self, key, value):
+ if not isinstance(key, basestring):
+ raise TypeError('Only string keys are supported')
+ elif not isinstance(value, basestring):
+ raise TypeError('Only string values are supported')
+
data = self._execute("SELECT * from %s where key=?;" %
self.table, [key])
exists = len(list(data))