[FIX] ir.model: workaround for broken Python 2.6 implementations

Apparently on some RedHat/CentOS version certain
Python 2.6 version do not support more than
4 nested levels of boolean filters.

lp bug: https://launchpad.net/bugs/939653 fixed

bzr revid: odo@openerp.com-20120227100953-2wgr0l621tpu1x4x
This commit is contained in:
Olivier Dony 2012-02-27 11:09:53 +01:00
parent 3f2c207322
commit a43f7940dc
1 changed files with 7 additions and 5 deletions

View File

@ -35,12 +35,14 @@ import pooler
_logger = logging.getLogger(__name__)
def _get_fields_type(self, cr, uid, context=None):
# Avoid too many nested `if`s below, as RedHat's Python 2.6
# break on it. See bug 939653.
return sorted([(k,k) for k,v in fields.__dict__.iteritems()
if type(v) == types.TypeType
if issubclass(v, fields._column)
if v != fields._column
if not v._deprecated
if not issubclass(v, fields.function)])
if type(v) == types.TypeType and \
issubclass(v, fields._column) and \
v != fields._column and \
not v._deprecated and \
not issubclass(v, fields.function)])
def _in_modules(self, cr, uid, ids, field_name, arg, context=None):
#pseudo-method used by fields.function in ir.model/ir.model.fields