[selector] cleanup stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 29 Sep 2010 12:17:26 +0200
branchstable
changeset 6360 1edfc0f3bb1d
parent 6359 0bff5a05385c
child 6361 843684a50e48
[selector] cleanup
selectors.py
server/test/unittest_querier.py
--- a/selectors.py	Wed Sep 29 12:16:28 2010 +0200
+++ b/selectors.py	Wed Sep 29 12:17:26 2010 +0200
@@ -1049,12 +1049,12 @@
             return self.score_entity(kwargs['entity'])
         if rset is None:
             return 0
-        user = req.user
-        action = self.action
         if row is None:
             score = 0
             need_local_check = []
             geteschema = req.vreg.schema.eschema
+            user = req.user
+            action = self.action
             for etype in rset.column_types(0):
                 if etype in BASE_TYPES:
                     return 0
@@ -1071,7 +1071,7 @@
             if need_local_check:
                 # check local role for entities of necessary types
                 for i, row in enumerate(rset):
-                    if not rset.description[i][0] in need_local_check:
+                    if not rset.description[i][col] in need_local_check:
                         continue
                     if not self.score(req, rset, i, col):
                         return 0
--- a/server/test/unittest_querier.py	Wed Sep 29 12:16:28 2010 +0200
+++ b/server/test/unittest_querier.py	Wed Sep 29 12:17:26 2010 +0200
@@ -1163,7 +1163,6 @@
         self.assertRaises(QueryError, self.execute, "SET X nom 'toto', X has_text 'tutu' WHERE X is Personne")
         self.assertRaises(QueryError, self.execute, "SET X login 'tutu', X eid %s" % cnx.user(self.session).eid)
 
-
     # upassword encryption tests #################################################
 
     def test_insert_upassword(self):