merge 3.17.15 into 3.18 branch stable
authorJulien Cristau <julien.cristau@logilab.fr>
Tue, 10 Jun 2014 09:35:26 +0200
branchstable
changeset 9769 d3f8866a48f5
parent 9767 b0b03ac1d03a (current diff)
parent 9734 f61bb1a033e4 (diff)
child 9770 112c884b2d8d
child 9771 2656ac7fa9a8
merge 3.17.15 into 3.18 branch
.hgtags
__pkginfo__.py
cubicweb.spec
debian/changelog
server/repository.py
server/test/unittest_rql2sql.py
test/data/schema.py
test/unittest_entity.py
--- a/.hgtags	Thu Jun 05 16:15:29 2014 +0200
+++ b/.hgtags	Tue Jun 10 09:35:26 2014 +0200
@@ -329,6 +329,9 @@
 fa00fc251d57f61e619d9c905502745fae21c58c cubicweb-centos-version-3.17.14-1
 fa00fc251d57f61e619d9c905502745fae21c58c cubicweb-version-3.17.14
 fa00fc251d57f61e619d9c905502745fae21c58c cubicweb-debian-version-3.17.14-1
+ee413076752b3e606801ef55e48f7e7ccd1f7238 cubicweb-version-3.17.15
+ee413076752b3e606801ef55e48f7e7ccd1f7238 cubicweb-debian-version-3.17.15-1
+ee413076752b3e606801ef55e48f7e7ccd1f7238 cubicweb-centos-version-3.17.15-1
 db37bf35a1474843ded0a537f9cb4838f4a78cda cubicweb-version-3.18.0
 db37bf35a1474843ded0a537f9cb4838f4a78cda cubicweb-debian-version-3.18.0-1
 db37bf35a1474843ded0a537f9cb4838f4a78cda cubicweb-centos-version-3.18.0-1
--- a/debian/changelog	Thu Jun 05 16:15:29 2014 +0200
+++ b/debian/changelog	Tue Jun 10 09:35:26 2014 +0200
@@ -34,6 +34,12 @@
 
  -- Julien Cristau <julien.cristau@logilab.fr>  Fri, 10 Jan 2014 17:14:18 +0100
 
+cubicweb (3.17.15-1) unstable; urgency=low
+
+  * new upstream release
+
+ -- Aurelien Campeas <aurelien.campeas@logilab.fr>  Wed, 13 May 2014 17:47:00 +0200
+
 cubicweb (3.17.14-1) unstable; urgency=low
 
   * new upstream release
--- a/server/repository.py	Thu Jun 05 16:15:29 2014 +0200
+++ b/server/repository.py	Tue Jun 10 09:35:26 2014 +0200
@@ -1455,11 +1455,7 @@
                         if relcache is not None:
                             session.update_rel_cache_del(entity.eid, attr, prevvalue)
                     del_existing_rel_if_needed(session, entity.eid, attr, value)
-                    if relcache is not None:
-                        session.update_rel_cache_add(entity.eid, attr, value)
-                    else:
-                        entity.cw_set_relation_cache(attr, 'subject',
-                                                     session.eid_rset(value))
+                    session.update_rel_cache_add(entity.eid, attr, value)
                     hm.call_hooks('after_add_relation', session,
                                   eidfrom=entity.eid, rtype=attr, eidto=value)
         finally:
--- a/server/test/unittest_rql2sql.py	Thu Jun 05 16:15:29 2014 +0200
+++ b/server/test/unittest_rql2sql.py	Tue Jun 10 09:35:26 2014 +0200
@@ -1882,12 +1882,12 @@
         for t in self._parse([("Any X WHERE X creation_date TODAY, X is Affaire",
                         '''SELECT _X.cw_eid
 FROM cw_Affaire AS _X
-WHERE DATE(_X.cw_creation_date)=CURRENT_DATE'''),
+WHERE DATE(_X.cw_creation_date)=%s''' % self.dbhelper.sql_current_date()),
 
                        ("Personne P where not P datenaiss TODAY",
                         '''SELECT _P.cw_eid
 FROM cw_Personne AS _P
-WHERE NOT (DATE(_P.cw_datenaiss)=CURRENT_DATE)'''),
+WHERE NOT (DATE(_P.cw_datenaiss)=%s)''' % self.dbhelper.sql_current_date()),
                        ]):
             yield t
 
--- a/test/data/schema.py	Thu Jun 05 16:15:29 2014 +0200
+++ b/test/data/schema.py	Tue Jun 10 09:35:26 2014 +0200
@@ -60,7 +60,7 @@
 
 
 class Produit(EntityType):
-    fabrique_par = SubjectRelation('Usine', cardinality='1*')
+    fabrique_par = SubjectRelation('Usine', cardinality='1*', inlined=True)
 
 
 class Usine(EntityType):
--- a/test/unittest_entity.py	Thu Jun 05 16:15:29 2014 +0200
+++ b/test/unittest_entity.py	Tue Jun 10 09:35:26 2014 +0200
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# copyright 2003-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
 #
 # This file is part of CubicWeb.
@@ -44,6 +44,18 @@
         for cls in self.vreg['etypes'].iter_classes():
             cls.fetch_attrs, cls.cw_fetch_order = self.backup_dict[cls]
 
+    def test_no_prefill_related_cache_bug(self):
+        session = self.session
+        usine = session.create_entity('Usine', lieu=u'Montbeliard')
+        produit = session.create_entity('Produit')
+        # usine was prefilled in glob_add_entity
+        # let's simulate produit creation without prefill
+        produit._cw_related_cache.clear()
+        # use add_relations
+        session.add_relations([('fabrique_par', [(produit.eid, usine.eid)])])
+        self.assertEqual(1, len(usine.reverse_fabrique_par))
+        self.assertEqual(1, len(produit.fabrique_par))
+
     def test_boolean_value(self):
         e = self.vreg['etypes'].etype_class('CWUser')(self.request())
         self.assertTrue(e)