Comment 1 for bug 330999

Revision history for this message
Fabien Lydoire @ Taktik (fl-taktik) wrote :

I just patched sql_db.py.
I know it's an horrible fix, it raises exceptions, but it breaks the infinite loop.
I hope that will help the OpenERP Team to make a better fix.

         @wraps(f)
         def wrapper(self, *args, **kwargs):
- if not hasattr(self, '_obj'):
+ if not (f.func_name=='__getattr__' and args==('_obj',)) and not hasattr(self, '_obj'):
                 raise psycopg2.ProgrammingError('Unable to use the cursor after having closing it')
             return f(self, *args, **kwargs)
         return wrapper

     @check
     def __getattr__(self, name):
- return getattr(self._obj, name)
+ if name!='_obj':
+ return getattr(self._obj, name)
+ else:
+ return None