# HG changeset patch # User Julien Cristau # Date 1450780543 -3600 # Node ID 6424a2e112f5dcbf0ba3e3a0bbb206c0774313fb # Parent 7cb02ab4f321160db41d811982d62ef5afb0fd5a [schema] rebuild computed attributes on schema reload If we have new computed attributes we need to set their formula_select attribute or things get sad. diff -r 7cb02ab4f321 -r 6424a2e112f5 schema.py --- a/schema.py Tue Dec 22 10:39:05 2015 +0100 +++ b/schema.py Tue Dec 22 11:35:43 2015 +0100 @@ -1134,6 +1134,7 @@ def rebuild_infered_relations(self): super(CubicWebSchema, self).rebuild_infered_relations() + self.finalize_computed_attributes() self.finalize_computed_relations() diff -r 7cb02ab4f321 -r 6424a2e112f5 server/test/unittest_migractions.py --- a/server/test/unittest_migractions.py Tue Dec 22 10:39:05 2015 +0100 +++ b/server/test/unittest_migractions.py Tue Dec 22 11:35:43 2015 +0100 @@ -914,8 +914,10 @@ self.assertIn('note100', self.schema) with self.mh() as (cnx, mh): mh.cmd_sync_schema_props_perms('note100') - self.assertEqual(self.schema['note100'].rdefs['Note', 'Int'].formula, - 'Any N*100 WHERE X note N') + rdef = self.schema['note100'].rdefs['Note', 'Int'] + self.assertEqual(rdef.formula_select.as_string(), + 'Any (N * 100) WHERE X note N, X is Note') + self.assertEqual(rdef.formula, 'Any N*100 WHERE X note N') def test_computed_attribute_sync_schema_props_perms_rdef(self): self.setup_add_score()