werkzeug > 0.9: Exceptions raised from a report lead to an OpenERP client error

Bug #1243773 reported by Houzéfa Abbasbhay
34
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Odoo Web (MOVED TO GITHUB)
Confirmed
Medium
OpenERP R&D Web Team

Bug Description

Hi,

I have webkit reports which can raise exceptions (either from the report class that derives from report_webkit.webkit_report.WebKitParser or from the parser class that derives from openerp.report.report_sxw.rml_parse) using the usual "raise osv.except_osv(title, message)" way.

The exceptions have been working fine with werkzeug 0.8.3: an error dialog was shown and the creation of the report got properly cancelled.

When upgrading werkzeug to a version > 0.9 (tried 0.9.3 and 0.9.4), I instead get an "OpenERP Client error" with the content: "Uncaught SyntaxError: Unexpected end of input".

This bug seems to have come up before in another fashion: see bug #1193563.

I am using rev 4038 of openerp-web/7.0, rev 5101 of openobject-server/7.0, rev 9523 of openobject-addons/7.0. The above bug should have been fixed in those revisions.

Please have a look - I am of course available for further questions.

Revision history for this message
Houzéfa Abbasbhay (houzefa-abba) wrote :
Revision history for this message
Houzéfa Abbasbhay (houzefa-abba) wrote :

Here is a test case: the module creates a report attached to res.users objects; the report can be printed by selecting a user in the user list and clicking on "Print > Test report".

With werkzeug 0.8, the raise is properly caught and results in a nice error dialog.
With werkzeug 0.9, a client error shows up.

Repo of the test: <https://bitbucket.org/houzefa-abba/report-test/overview>

Revision history for this message
Twinkle Christian(OpenERP) (tch-openerp) wrote :

Hello,

Would you please provide your tested screen cast ? So, according to that I can reproduce it in better way.

Thanks & waiting for your answer..!!

Changed in openerp-web:
status: New → Incomplete
Revision history for this message
Houzéfa Abbasbhay (houzefa-abba) wrote :

Hi,

Here is a screencast showcasing the above exception raised from a test report.

The screencast starts with werkzeug 0.8.3 and shows the expected result (an exception is shown as a nice error box).
I then uninstall werkzeug 0.8.3 and install its latest version (0.9.4); running the same test now produces a client error.
I then uninstall werkzeug 0.9.4 and go back to the point blank; the exception dialog works fine again.

Revision history for this message
Twinkle Christian(OpenERP) (tch-openerp) wrote :
Revision history for this message
Twinkle Christian(OpenERP) (tch-openerp) wrote :
Revision history for this message
Twinkle Christian(OpenERP) (tch-openerp) wrote :

Hello,

Thanks for the video and nice explanation..!!

please check your module .. it is not a bug,but its your module issue, I have attached correct solution in above attached patch.

So, I am marking it as a invalid.

Thanks.

Changed in openerp-web:
status: Incomplete → Invalid
Revision history for this message
Houzéfa Abbasbhay (houzefa-abba) wrote :

Huh? ...

You have commented out the test_raise call so of course this "works", if you can call "printing a report" as "working", which is absolutely not what this bug thread is about.

The problem exposed here is not that the exception i *intentionally* introduced was preventing the report from printing; it is that after a werkzeug upgrade to a version > 0.9, said exception does not appear but instead leads to a client error.

Changed in openerp-web:
status: Invalid → New
Revision history for this message
Anael Lorimier (anael-lorimier) wrote :

Hi,

"please check your module .. it is not a bug,but its your module issue, I have attached correct solution in above attached patch."

Check the diff between houzefa's file, and your patch :

diff tmp tmp2
25c25
< self.test_raise()
---
> #self.test_raise()

Is it a joke ?

Changed in openerp-web:
assignee: nobody → OpenERP R&D Web Team (openerp-dev-web)
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Cats&Dogs (catsanddogs) wrote :

Having the same problem

Working on revisions: server: 5166, addons: 9682, web: 4085
and Werkzeug 0.9.4

When printing I get a client error: Uncaught SyntaxError: Unexpected end of input

Also checked the fix for Bug #1193563, the fixes are still in place with the latest revision

Revision history for this message
Wennaël LOONIS (wloonis) wrote :

Hello,
I encountered the same problem.
With OpenErp 7.x, when the error is displayed in plain/text (via Werkzeug ServerInternalError), the message contains:
<! DOCTYPE HTML PUBLIC "- // W3C // DTD HTML 3.2 Final // EN">
<Title> 500 Internal Server Error </ title>
<H1> Internal Server Error </ h1>
{My json}

The content is interpreted on the client side to display a correct message.

With Werkzeug 0.9.x, the content is changed. Special characters are encoded.
We have:

<! DOCTYPE HTML PUBLIC "- // W3C // DTD HTML 3.2 Final // EN">
<Title> 500 Internal Server Error </ title>
<H1> Internal Server Error </ h1>
& Quot; My json & quot;

This causes a client side error.

You must patch Openerp http.py and wsgi_server.py for this to work. In my case, I memorize the content of the initial message, after the Werzeug encoding, I then postpone the initial one

Regards,
Wennaël

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.