exception if fields.py if no _context
Bug #625896 reported by
Jim Norman
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Fix Released
|
Undecided
|
Anup(SerpentCS) |
Bug Description
I made this change some time ago, and no longer have the traceback.
An exception is thrown in osv/fields.py if self._context is False
The following change fixes the problem:
=== modified file 'bin/osv/fields.py'
--- bin/osv/fields.py 2010-08-13 00:23:21 +0000
+++ bin/osv/fields.py 2010-08-20 18:52:39 +0000
@@ -428,7 +428,10 @@
if self._context:
- context.
+ try:
+ context.
+ except:
+ pass
if not values:
values = {}
Revision is 2572, trunk
On Saturday 28 August 2010, you wrote: update( self._context) update( self._context)
> I made this change some time ago, and no longer have the traceback.
> context = context.copy()
> - context.
> + try:
> + context.
> + except:
> + pass
> if not values:
> values = {}
>
Just a remark of Pythonic twist:
*Please, avoid catching with "except:", but use "except Exception:" instead. *
The reason is that the first would catch KeyboardInterrupt and SystemExit,
which should never be handled in code like that.