Fix From C2C:

~c2c/openobject-server/openobject-server-log-bug
Bugfixes in Expression

bzr revid: fp@tinyerp.com-20080819225254-6gg6j2dalz666oti
This commit is contained in:
Fabien Pinckaers 2008-08-20 00:52:54 +02:00
parent 05d3922751
commit a7b0cfd6f5
4 changed files with 7 additions and 22 deletions

View File

@ -160,15 +160,8 @@ def init_logger():
logf = config['logfile']
# test if the directories exist, else create them
try:
if not os.path.exists(os.path.dirname(logf)):
os.makedirs(os.path.dirname(logf))
try:
fd = open(logf, 'a')
handler = logging.StreamHandler(fd)
except IOError:
sys.stderr.write("ERROR: couldn't open the logfile\n")
handler = logging.StreamHandler(sys.stdout)
except OSError:
handler = logging.handlers.TimedRotatingFileHandler(logf,'D',1,30)
except:
sys.stderr.write("ERROR: couldn't create the logfile directory\n")
handler = logging.StreamHandler(sys.stdout)
else:

View File

@ -68,7 +68,7 @@ class expression(object):
if not ids:
return []
ids2 = table.search(cr, uid, [(parent, 'in', ids)], context=context)
return [(prefix+left, 'in', ids2+ids)]
return [(prefix+left, 'in', ids + _rec_get(ids2, table, parent))]
self.__main_table = table
@ -164,9 +164,11 @@ class expression(object):
self.__operator = 'in'
if field._obj != working_table._name:
dom = _rec_get(ids2, field_obj, working_table._parent_name,)
dom = _rec_get(ids2, field_obj, working_table._parent_name, left=left)
print 'Diff', dom, field._obj
else:
dom = _rec_get(ids2, working_table, left)
print 'Same', dom
self.__exp = self.__exp[:i] + dom + self.__exp[i+1:]
else:
if isinstance(right, basestring):

View File

@ -165,19 +165,11 @@ class osv_pool(netsvc.Service):
#TODO: pass a list of modules to load
def instanciate(self, module, cr):
# print "module list:", module_list
# for module in module_list:
res = []
class_list = module_class_list.get(module, [])
# if module not in self.module_object_list:
# print "%s class_list:" % module, class_list
for klass in class_list:
res.append(klass.createInstance(self, module, cr))
return res
# else:
# print "skipping module", module
#pooler.get_pool(cr.dbname) = osv_pool()
class osv_memory(orm.orm_memory):
#__metaclass__ = inheritor
@ -236,9 +228,6 @@ class osv(orm.orm):
parent_name = hasattr(cls, '_inherit') and cls._inherit
if parent_name:
parent_class = pool.get(parent_name).__class__
print cls
print cls._name
assert pool.get(parent_name), "parent class %s does not exist in module %s !" % (parent_name, module)
nattr = {}
for s in ('_columns', '_defaults', '_inherits', '_constraints', '_sql_constraints'):

View File

@ -59,6 +59,7 @@ class fake_cursor:
self.dbname = dbname
def execute(self, sql, params=None):
print sql,params
if not params:
params=()
def base_string(s):