merge 3.14.x fix into 3.15.x oldstable
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Mon, 08 Apr 2013 12:42:36 +0200
brancholdstable
changeset 8860 e5db11a399be
parent 8859 6ed22ac7257c (current diff)
parent 8856 7d28082445b9 (diff)
child 8861 38c6a3ea8252
merge 3.14.x fix into 3.15.x
.hgtags
__pkginfo__.py
debian/changelog
server/test/unittest_querier.py
--- a/.hgtags	Wed Apr 03 10:51:15 2013 +0200
+++ b/.hgtags	Mon Apr 08 12:42:36 2013 +0200
@@ -258,6 +258,8 @@
 81394043ad226942ac0019b8e1d4f7058d67a49f cubicweb-debian-version-3.14.8-1
 9337812cef6b949eee89161190e0c3d68d7f32ea cubicweb-version-3.14.9
 68c762adf2d5a2c338910ef1091df554370586f0 cubicweb-debian-version-3.14.9-1
+0ff798f80138ca8f50a59f42284380ce8f6232e8 cubicweb-version-3.14.10
+197bcd087c87cd3de9f21f5bf40bd6203c074f1f cubicweb-debian-version-3.14.10-1
 783a5df54dc742e63c8a720b1582ff08366733bd cubicweb-version-3.15.1
 fe5e60862b64f1beed2ccdf3a9c96502dfcd811b cubicweb-debian-version-3.15.1-1
 2afc157ea9b2b92eccb0f2d704094e22ce8b5a05 cubicweb-version-3.15.2
--- a/debian/changelog	Wed Apr 03 10:51:15 2013 +0200
+++ b/debian/changelog	Mon Apr 08 12:42:36 2013 +0200
@@ -68,6 +68,12 @@
 
  -- Sylvain Thénault <sylvain.thenault@logilab.fr>  Thu, 12 Apr 2012 13:52:05 +0200
 
+cubicweb (3.14.10-1) unstable; urgency=low
+
+  * new upstream release
+
+ -- Pierre-Yves David <pierre-yves.david@logilab.fr>  Mon, 08 Apr 2013 12:18:20 +0200
+
 cubicweb (3.14.9-1) unstable; urgency=low
 
   * new upstream release
--- a/server/ssplanner.py	Wed Apr 03 10:51:15 2013 +0200
+++ b/server/ssplanner.py	Mon Apr 08 12:42:36 2013 +0200
@@ -79,7 +79,12 @@
     checkread = session.read_security
     eschema = session.vreg.schema.eschema
     for rel in rqlst.where.get_nodes(Relation):
-        if rel.r_type == 'eid' and not rel.neged(strict=True):
+        # only care for 'eid' relations ...
+        if (rel.r_type == 'eid'
+            # ... that are not part of a NOT clause ...
+            and not rel.neged(strict=True)
+            # ... and where eid is specified by '=' operator.
+            and rel.children[1].operator == '='):
             lhs, rhs = rel.get_variable_parts()
             if isinstance(rhs, Constant):
                 eid = typed_eid(rhs.eval(plan.args))
--- a/server/test/unittest_querier.py	Wed Apr 03 10:51:15 2013 +0200
+++ b/server/test/unittest_querier.py	Mon Apr 08 12:42:36 2013 +0200
@@ -1517,5 +1517,28 @@
             res = self.execute('Any X WHERE X has_text %(text)s', {'text': 'aff2'})
             self.assertEqual(res.rows, [[aff2.eid]])
 
+    def test_set_relations_eid(self):
+        req = self.request()
+        # create 3 email addresses
+        a1 = req.create_entity('EmailAddress', address=u'a1')
+        a2 = req.create_entity('EmailAddress', address=u'a2')
+        a3 = req.create_entity('EmailAddress', address=u'a3')
+        # SET relations using '>=' operator on eids
+        req.execute('SET U use_email A WHERE U login "admin", A eid >= %s' % a2.eid)
+        self.assertEqual(
+            [[a2.eid], [a3.eid]],
+            req.execute('Any A ORDERBY A WHERE U use_email A, U login "admin"').rows)
+        # DELETE
+        req.execute('DELETE U use_email A WHERE U login "admin", A eid > %s' % a2.eid)
+        self.assertEqual(
+            [[a2.eid]],
+            req.execute('Any A ORDERBY A WHERE U use_email A, U login "admin"').rows)
+        req.execute('DELETE U use_email A WHERE U login "admin"')
+        # SET relations using '<' operator on eids
+        req.execute('SET U use_email A WHERE U login "admin", A eid < %s' % a2.eid)
+        self.assertEqual(
+            [[a1.eid]],
+            req.execute('Any A ORDERBY A WHERE U use_email A, U login "admin"').rows)
+
 if __name__ == '__main__':
     unittest_main()