# HG changeset patch # User Pierre-Yves David # Date 1365417756 -7200 # Node ID e5db11a399be5585bb601c2868f250045cad8df1 # Parent 6ed22ac7257c7d396d6ccd5af0d8778d5db9d2bc# Parent 7d28082445b9b202ca150908e4e497d4a69f6634 merge 3.14.x fix into 3.15.x diff -r 6ed22ac7257c -r e5db11a399be .hgtags --- 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 diff -r 6ed22ac7257c -r e5db11a399be __pkginfo__.py diff -r 6ed22ac7257c -r e5db11a399be debian/changelog --- 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 Thu, 12 Apr 2012 13:52:05 +0200 +cubicweb (3.14.10-1) unstable; urgency=low + + * new upstream release + + -- Pierre-Yves David Mon, 08 Apr 2013 12:18:20 +0200 + cubicweb (3.14.9-1) unstable; urgency=low * new upstream release diff -r 6ed22ac7257c -r e5db11a399be server/ssplanner.py --- 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)) diff -r 6ed22ac7257c -r e5db11a399be server/test/unittest_querier.py --- 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()