← Back to team overview

openerp-expert-framework team mailing list archive

Open ERP Exceptions on Exceptions bug

 

Hello All,

I think these are the communities which have to review this:

Open ERP uses raise "Exception as string" in several places which is
depreciated in Python 2.6 bundled with the most popular Ubuntu OS (9.10
Karmic).

Python 2.6 requires exceptions to be classes and not strings. As a result of
this many exceptions turn out to be exceptions. An example of this would be
an attempted inheritance of osv_memory wizards which is not supported in
5.0.X. Instead of showing a meaningful exception or message, the server will
error out because the exception code is itself an error.
You can simply try:

raise "Error"

and you can see that it errors out in python 2.6, the correct one should be

raise Exception("error")

However most Open ERP exceptions are classes. Eg. except_osv used in
modules, except_orm used in osv and simple Exception class used in the orm.

Exceptions as classes are supported from ver 2.4 of python and has been
tested by Raphael Valyi.
In version 2.5 the wrong usage gives a depreciation warning, however we
ignored them.

I request the community to review my merge proposal which is here:
https://code.launchpad.net/~sharoonthomas/openobject-server/5_0_orm_and_osv_cleaned_strException/+merge/15773

The corrections i have done is simple and dumb and extremely clear that it
wont break anything. If this merge proposal is approved i think we can
collectively clean other modules and files including fields.py which has the
same problem.

Thanks & Regards

Sharoon Thomas