Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Test formula failure #511

Open
wants to merge 1 commit into from

2 participants

@jean
Owner

Start to test reports of formula failures. Lots of room for improvement.

@coveralls

Coverage Status

Coverage decreased (-0.03%) when pulling 9c3d31d on jean-test-formula-failed into becce4e on github-main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 6, 2013
  1. @jean

    Test formula failure

    jean authored
This page is out of date. Refresh to see the latest.
Showing with 22 additions and 0 deletions.
  1. +22 −0 Products/CMFPlomino/tests/plomino.txt
View
22 Products/CMFPlomino/tests/plomino.txt
@@ -180,6 +180,28 @@ And scripts can include scripts that include scripts ...::
>>> db.frm1.computeFieldValue('field7', db.frm1)
'hello'
+When formulas fail, and the database is in debug mode, the error is logged
+--------------------------------------------------------------------------
+
+First we mess up one of our scripts. We choose a script in
+``resources`` which is indirectly included by a field formula,
+so that we are testing that *include* functionality works at the same time::
+
+ >>> ps = db.resources._getOb('script_too')
+ >>> ps.write('burp')
+
+Delete compiled scripts; next access will trigger recompilation::
+
+ >>> db.scripts.manage_delObjects(list(db.scripts.objectIds()))
+
+Now cause the formula to be executed, the error will be reported
+to the user as a portal message::
+
+ >>> db.frm1.computeFieldValue('field7', db.frm1)
+ >>> msg = db.plone_utils.showPortalMessages()[0]
+ >>> msg.message
+ u"field7 field formula failed - Plomino formula /plone/mydb/frm1/field7/Formula - Plomino traceback line 24, in field_-_frm1_-_field7_-_formula\r\n<br/>NameError: global name 'burp' is not defined\r\n<br/>Context is &lt;PlominoForm&gt; /plone/mydb/frm1"
+
Documents
---------------
Something went wrong with that request. Please try again.