[workflow] set default test/plain option for workflow default comment (closes #993083) stable
authorKatia Saurfelt <katia.saurfelt@logilab.fr>
Thu, 29 Mar 2012 14:25:51 +0200
branchstable
changeset 8336 7ccd4367ee1c
parent 8335 eef305ace54c
child 8337 b5275e739a44
[workflow] set default test/plain option for workflow default comment (closes #993083)
misc/migration/3.14.3_Any.py
misc/migration/3.14.7_Any.py
schemas/workflow.py
test/unittest_schema.py
--- a/misc/migration/3.14.3_Any.py	Thu Mar 29 14:24:49 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-# keep the same behavior on existing instance but use the new one on new instance.
-config['https-deny-anonymous'] = True
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/migration/3.14.7_Any.py	Thu Mar 29 14:25:51 2012 +0200
@@ -0,0 +1,4 @@
+# migrate default format for TriInfo `comment_format` attribute
+sync_schema_props_perms('TrInfo')
+
+commit()
--- a/schemas/workflow.py	Thu Mar 29 14:24:49 2012 +0200
+++ b/schemas/workflow.py	Thu Mar 29 14:25:51 2012 +0200
@@ -185,7 +185,7 @@
     # make by_transition optional because we want to allow managers to set
     # entity into an arbitrary state without having to respect wf transition
     by_transition = SubjectRelation('BaseTransition', cardinality='?*')
-    comment = RichString(fulltextindexed=True)
+    comment = RichString(fulltextindexed=True, default_format='text/plain')
     tr_count = Int(description='autocomputed attribute used to ensure transition coherency')
     # get actor and date time using owned_by and creation_date
 
--- a/test/unittest_schema.py	Thu Mar 29 14:24:49 2012 +0200
+++ b/test/unittest_schema.py	Thu Mar 29 14:25:51 2012 +0200
@@ -348,6 +348,10 @@
         self.assertEqual(cstr.repo_check(self.session, 1, self.session.user.eid),
         None) # no validation error, constraint checked
 
+class WorkflowShemaTC(CubicWebTC):
+    def test_trinfo_default_format(self):
+         tr = self.session.user.cw_adapt_to('IWorkflowable').fire_transition('deactivate')
+         self.assertEqual(tr.comment_format, 'text/plain')
 
 if __name__ == '__main__':
     unittest_main()