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>
This commit is contained in:
parent
d43e7a91f2
commit
824acff967
|
@ -77,6 +77,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))
|
||||
|
|
Loading…
Reference in New Issue