From d0e614aeedc36cab7f67f7f089ab4cb8e574312f Mon Sep 17 00:00:00 2001 From: Christophe Simonis Date: Fri, 19 Dec 2008 20:17:59 +0100 Subject: [PATCH] [IMP] "not x in l" -> "x not in l" [IMP] use the second parameter of cr.execute instead of formating the query ourself bzr revid: christophe@cobalt-20081219191759-79riaoi58pm0jsff --- bin/osv/orm.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/osv/orm.py b/bin/osv/orm.py index 2efdf20b6c9..0a394723a97 100644 --- a/bin/osv/orm.py +++ b/bin/osv/orm.py @@ -129,7 +129,7 @@ class browse_record(object): cache.setdefault(table._name, {}) self._data = cache[table._name] - if not id in self._data: + if id not in self._data: self._data[id] = {'id': id} self._cache = cache @@ -137,7 +137,7 @@ class browse_record(object): def __getitem__(self, name): if name == 'id': return self._id - if not name in self._data[self._id]: + if name not in self._data[self._id]: # build the list of fields we will fetch # fetch the definition of the field which was asked for @@ -166,7 +166,7 @@ class browse_record(object): # otherwise we fetch only that field else: ffields = [(name, col)] - ids = filter(lambda id: not name in self._data[id], self._data.keys()) + ids = filter(lambda id: name not in self._data[id], self._data.keys()) # read the data fffields = map(lambda x: x[0], ffields) datas = self._table.read(self._cr, self._uid, ids, fffields, context=self._context, load="_classic_write") @@ -302,11 +302,11 @@ class orm_template(object): _invalids = set() def _field_create(self, cr, context={}): - cr.execute("SELECT id FROM ir_model WHERE model='%s'" % self._name) + cr.execute("SELECT id FROM ir_model WHERE model=%s", (self._name,)) if not cr.rowcount: cr.execute('SELECT nextval(%s)', ('ir_model_id_seq',)) model_id = cr.fetchone()[0] - cr.execute("INSERT INTO ir_model (id,model, name, info,state) VALUES (%s, %s, %s, %s,%s)", (model_id, self._name, self._description, self.__doc__, 'base')) + cr.execute("INSERT INTO ir_model (id,model, name, info,state) VALUES (%s, %s, %s, %s, %s)", (model_id, self._name, self._description, self.__doc__, 'base')) else: model_id = cr.fetchone()[0] if 'module' in context: