]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
persist_data: don't allow non-string keys/values
authorChris Larson <chris_larson@mentor.com>
Mon, 4 Apr 2011 16:37:07 +0000 (09:37 -0700)
committerChris Larson <chris_larson@mentor.com>
Wed, 6 Apr 2011 00:21:48 +0000 (17:21 -0700)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
lib/bb/persist_data.py

index baade7c4f14d74994c558f4c56b8dffcb2227a72..aa2ede4b937c79ec763fc915d29ed715bfe91b30 100644 (file)
@@ -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))