Werkzeug 0.9.x fails on print button

Bug #1199772 reported by Florent Aide
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Odoo Web (MOVED TO GITHUB)
New
Undecided
Unassigned

Bug Description

When using latest revision of openerp-web from branch 7.0 with latest revision from openerp-server from branch 7.0 there is no version cap on werkzeug.
Since Werkzeug released a new version on june 13th (and 14th) there is an issue in the print button of any report.

It seems that openerp tries to set a cookie by passing an integer value and Werkzeug refuses the value and raises an exception:

2013-07-10 12:28:47,744 8840 ERROR demo1 openerp.addons.web.http.HttpRequest.dispatch: An error occurred while handling a json request
Traceback (most recent call last):
  File "/home/faide/progs/openerp7/sources/openerp-web/addons/web/http.py", line 285, in dispatch
    r = method(self, **self.params)
  File "/home/faide/progs/openerp7/sources/openerp-web/addons/web/controllers/main.py", line 1770, in index
    cookies={'fileToken': int(token)})
  File "/home/faide/progs/openerp7/sources/openerp-web/addons/web/http.py", line 332, in make_response
    response.set_cookie(k, v)
  File "/home/faide/progs/openerp7/env-openerp/local/lib/python2.7/site-packages/Werkzeug-0.9.1-py2.7.egg/werkzeug/wrappers.py", line 960, in set_cookie
    self.charset))
  File "/home/faide/progs/openerp7/env-openerp/local/lib/python2.7/site-packages/Werkzeug-0.9.1-py2.7.egg/werkzeug/http.py", line 905, in dump_cookie
    value = to_bytes(value, charset)
  File "/home/faide/progs/openerp7/env-openerp/local/lib/python2.7/site-packages/Werkzeug-0.9.1-py2.7.egg/werkzeug/_compat.py", line 106, in to_bytes
    raise TypeError('Expected bytes')
TypeError: Expected bytes

This error does not occur if using Werkzeug 0.8.3 but occurs if using Werkzeug 0.9 and 0.9.1.

Removing all int() casts in openerp-web/addons/web/controllers/main.py works for some cases but still provokes errors on some unclear conditions so I would not propose this as a proper fix for the moment:

2013-07-10 12:38:10,090 9116 ERROR ? openerp.addons.web.http.HttpRequest.dispatch: An error occurred while handling a json request
Traceback (most recent call last):
  File "/home/faide/progs/openerp7/sources/openerp-web/addons/web/http.py", line 285, in dispatch
    r = method(self, **self.params)
TypeError: index() takes exactly 4 arguments (2 given)

The easiest solution to fix this for the moment is to require "werkzeug<0.9" in the setup.py of openobject-server (avoids future install issues) and mannually downgrade werkzeug to the last know working version (0.8.3) on all servers installed after June 13th 2013

To reproduce this install a FRESH version of openerp (web+server) that will pull its dependencies from internet and verify that you obtained a werkzeug > 0.8.3
Then intall the purchase module in any database. Then create a purchase order and try to click the print button. You should get the same traceback

Tags: dependency
Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

Hi Florent, marking your bug as a duplicate. We arrived at the same fix as yours, but did not come across additional problems yet. It sounds self defeating, but if you have additional hints about the unclear conditions under which the problem persists, please put them on the original bug report.

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.