merge
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 10 Aug 2009 18:01:46 +0200
changeset 2758 8a54f91a43e1
parent 2756 2c94606eefc0 (diff)
parent 2757 c8e28e1754f0 (current diff)
child 2759 23d7a75693f8
child 2760 30063071aee0
merge
--- a/server/repository.py	Mon Aug 10 15:54:28 2009 +0200
+++ b/server/repository.py	Mon Aug 10 18:01:46 2009 +0200
@@ -1030,6 +1030,9 @@
             if rtype in VIRTUAL_RTYPES:
                 continue
             entity.set_related_cache(rtype, 'object', session.empty_rset())
+        # set inline relation cache before call to after_add_entity
+        for attr, value in relations:
+            session.update_rel_cache_add(entity.eid, attr, value)
         # trigger after_add_entity after after_add_relation
         if source.should_call_hooks:
             self.hm.call_hooks('after_add_entity', etype, session, entity)
@@ -1037,7 +1040,6 @@
             for attr, value in relations:
                 self.hm.call_hooks('before_add_relation', attr, session,
                                     entity.eid, attr, value)
-                session.update_rel_cache_add(entity.eid, attr, value)
                 self.hm.call_hooks('after_add_relation', attr, session,
                                     entity.eid, attr, value)
         return entity.eid
--- a/web/test/unittest_form.py	Mon Aug 10 15:54:28 2009 +0200
+++ b/web/test/unittest_form.py	Mon Aug 10 18:01:46 2009 +0200
@@ -124,12 +124,14 @@
             creation_date = DateTimeField(widget=DateTimePicker)
         form = CustomChangeStateForm(self.req, redirect_path='perdu.com',
                                      entity=self.entity)
-        form.form_render(state=123, trcomment=u'')
+        form.form_render(state=123, trcomment=u'',
+                         trcomment_format=u'text/plain')
 
     def test_change_state_form(self):
         form = ChangeStateForm(self.req, redirect_path='perdu.com',
                                entity=self.entity)
-        form.form_render(state=123, trcomment=u'')
+        form.form_render(state=123, trcomment=u'',
+                         trcomment_format=u'text/plain')
 
     # fields tests ############################################################
 
@@ -161,7 +163,7 @@
 
     def test_richtextfield_2(self):
         self.req.use_fckeditor = lambda: True
-        self._test_richtextfield('<input name="description_format:%(eid)s" style="display: block" type="hidden" value="text/rest" /><textarea cols="80" cubicweb:type="wysiwyg" id="description:%(eid)s" name="description:%(eid)s" onkeyup="autogrow(this)" rows="2" tabindex="1"></textarea>')
+        self._test_richtextfield('<input name="description_format:%(eid)s" type="hidden" value="text/rest" /><textarea cols="80" cubicweb:type="wysiwyg" id="description:%(eid)s" name="description:%(eid)s" onkeyup="autogrow(this)" rows="2" tabindex="1"></textarea>')
 
 
     def test_filefield(self):