summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2011-04-04 09:37:07 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-05-06 15:50:29 +0100
commit824acff967ff74c0a678bf8accc4a514653f5783 (patch)
treec6839bf90a5cb7586c5b820a95addfa95c296bc9
parentd43e7a91f29443b189b76d3b4fb55661f9fb8748 (diff)
downloadpoky-824acff967ff74c0a678bf8accc4a514653f5783.tar.gz
persist_data: don't allow non-string keys/values
(Bitbake rev: 28958cd55e592853c68f5f2ba79381d1b8dcfb8f) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/persist_data.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/bitbake/lib/bb/persist_data.py b/bitbake/lib/bb/persist_data.py
index bf8fd77bf1..c9e80ba967 100644
--- a/bitbake/lib/bb/persist_data.py
+++ b/bitbake/lib/bb/persist_data.py
@@ -77,6 +77,11 @@ class SQLTable(collections.MutableMapping):
77 self._execute("DELETE from %s where key=?;" % self.table, [key]) 77 self._execute("DELETE from %s where key=?;" % self.table, [key])
78 78
79 def __setitem__(self, key, value): 79 def __setitem__(self, key, value):
80 if not isinstance(key, basestring):
81 raise TypeError('Only string keys are supported')
82 elif not isinstance(value, basestring):
83 raise TypeError('Only string values are supported')
84
80 data = self._execute("SELECT * from %s where key=?;" % 85 data = self._execute("SELECT * from %s where key=?;" %
81 self.table, [key]) 86 self.table, [key])
82 exists = len(list(data)) 87 exists = len(list(data))