# HG changeset patch # User Aurelien Campeas # Date 1358530311 -3600 # Node ID aa865f3be80d8a623b580f5a02a7d818877264e2 # Parent 11707295d4e6bab9b47fa55a2ad5054b1454a910# Parent cd9fddc213617209e6a3fdcaa0cc8d96967482d4 [merge] backport stable fixes diff -r 11707295d4e6 -r aa865f3be80d entities/test/unittest_wfobjs.py --- a/entities/test/unittest_wfobjs.py Fri Jan 18 16:40:11 2013 +0100 +++ b/entities/test/unittest_wfobjs.py Fri Jan 18 18:31:51 2013 +0100 @@ -54,7 +54,8 @@ wf.add_state(u'foo') with self.assertRaises(ValidationError) as cm: self.commit() - self.assertEqual(cm.exception.errors, {'name-subject': 'workflow already have a state of that name'}) + self.assertEqual({'name-subject': 'workflow already has a state of that name'}, + cm.exception.errors) # no pb if not in the same workflow wf2 = add_wf(self, 'Company') foo = wf2.add_state(u'foo', initial=True) @@ -65,7 +66,8 @@ bar.cw_set(name=u'foo') with self.assertRaises(ValidationError) as cm: self.commit() - self.assertEqual(cm.exception.errors, {'name-subject': 'workflow already have a state of that name'}) + self.assertEqual({'name-subject': 'workflow already has a state of that name'}, + cm.exception.errors) def test_duplicated_transition(self): wf = add_wf(self, 'Company') diff -r 11707295d4e6 -r aa865f3be80d entity.py --- a/entity.py Fri Jan 18 16:40:11 2013 +0100 +++ b/entity.py Fri Jan 18 18:31:51 2013 +0100 @@ -579,10 +579,8 @@ """custom json dumps hook to dump the entity's eid which is not part of dict structure itself """ - self.complete() dumpable = self.cw_attr_cache.copy() dumpable['eid'] = self.eid - dumpable['__cwetype__'] = self.__regid__ return dumpable def cw_adapt_to(self, interface): diff -r 11707295d4e6 -r aa865f3be80d schemas/workflow.py --- a/schemas/workflow.py Fri Jan 18 16:40:11 2013 +0100 +++ b/schemas/workflow.py Fri Jan 18 18:31:51 2013 +0100 @@ -66,7 +66,7 @@ name = String(required=True, indexed=True, internationalizable=True, maxsize=256, constraints=[RQLUniqueConstraint('S name N, S state_of WF, Y state_of WF, Y name N', 'Y', - _('workflow already have a state of that name'))]) + _('workflow already has a state of that name'))]) description = RichString(default_format='text/rest', description=_('semantic description of this state')) diff -r 11707295d4e6 -r aa865f3be80d web/views/json.py --- a/web/views/json.py Fri Jan 18 16:40:11 2013 +0100 +++ b/web/views/json.py Fri Jan 18 18:31:51 2013 +0100 @@ -111,7 +111,12 @@ title = _('json-entities-export-view') def call(self): - if self.cw_rset is None: - self.wdata([self.cw_extra_kwargs.get('entity')]) - else: - self.wdata(list(self.cw_rset.entities())) + entities = [] + for entity in self.cw_rset.entities(): + entity.complete() # fetch all attributes + # hack to add extra metadata + entity.cw_attr_cache.update({ + '__cwetype__': entity.__regid__, + }) + entities.append(entity) + self.wdata(entities)