[REF] stricter checking of defauts in fields & orm __init__

bzr revid: ls@numerigraphe.fr-20101112134214-h27a1ewxr9c4g3id
This commit is contained in:
Numerigraphe - Lionel Sausin 2010-11-12 14:42:14 +01:00
parent 666c4ec067
commit e013734045
2 changed files with 12 additions and 4 deletions

View File

@ -64,6 +64,10 @@ class _column(object):
_symbol_get = None
def __init__(self, string='unknown', required=False, readonly=False, domain=None, context=None, states=None, priority=0, change_default=False, size=None, ondelete="set null", translate=False, select=False, **args):
if domain is None:
domain = []
if context is None:
context = {}
self.states = states or {}
self.string = string
self.readonly = readonly
@ -74,8 +78,8 @@ class _column(object):
self.change_default = change_default
self.ondelete = ondelete
self.translate = translate
self._domain = domain or []
self._context = context or {}
self._domain = domain
self._context = context
self.write = False
self.read = False
self.view_load = 0

View File

@ -131,6 +131,10 @@ class browse_record(object):
table : the object (inherited from orm)
context : dictionary with an optional context
'''
if fields_process is None:
domain = {}
if context is None:
context = {}
self._list_class = list_class or browse_record_list
self._cr = cr
self._uid = uid
@ -139,8 +143,8 @@ class browse_record(object):
self._table_name = self._table._name
self.__logger = logging.getLogger(
'osv.browse_record.' + self._table_name)
self._context = context or {}
self._fields_process = fields_process or {}
self._context = context
self._fields_process = fields_process
cache.setdefault(table._name, {})
self._data = cache[table._name]