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:
parent
05d3922751
commit
a7b0cfd6f5
|
@ -160,15 +160,8 @@ def init_logger():
|
||||||
logf = config['logfile']
|
logf = config['logfile']
|
||||||
# test if the directories exist, else create them
|
# test if the directories exist, else create them
|
||||||
try:
|
try:
|
||||||
if not os.path.exists(os.path.dirname(logf)):
|
handler = logging.handlers.TimedRotatingFileHandler(logf,'D',1,30)
|
||||||
os.makedirs(os.path.dirname(logf))
|
except:
|
||||||
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:
|
|
||||||
sys.stderr.write("ERROR: couldn't create the logfile directory\n")
|
sys.stderr.write("ERROR: couldn't create the logfile directory\n")
|
||||||
handler = logging.StreamHandler(sys.stdout)
|
handler = logging.StreamHandler(sys.stdout)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -68,7 +68,7 @@ class expression(object):
|
||||||
if not ids:
|
if not ids:
|
||||||
return []
|
return []
|
||||||
ids2 = table.search(cr, uid, [(parent, 'in', ids)], context=context)
|
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
|
self.__main_table = table
|
||||||
|
|
||||||
|
@ -164,9 +164,11 @@ class expression(object):
|
||||||
|
|
||||||
self.__operator = 'in'
|
self.__operator = 'in'
|
||||||
if field._obj != working_table._name:
|
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:
|
else:
|
||||||
dom = _rec_get(ids2, working_table, left)
|
dom = _rec_get(ids2, working_table, left)
|
||||||
|
print 'Same', dom
|
||||||
self.__exp = self.__exp[:i] + dom + self.__exp[i+1:]
|
self.__exp = self.__exp[:i] + dom + self.__exp[i+1:]
|
||||||
else:
|
else:
|
||||||
if isinstance(right, basestring):
|
if isinstance(right, basestring):
|
||||||
|
|
|
@ -165,19 +165,11 @@ class osv_pool(netsvc.Service):
|
||||||
|
|
||||||
#TODO: pass a list of modules to load
|
#TODO: pass a list of modules to load
|
||||||
def instanciate(self, module, cr):
|
def instanciate(self, module, cr):
|
||||||
# print "module list:", module_list
|
|
||||||
# for module in module_list:
|
|
||||||
res = []
|
res = []
|
||||||
class_list = module_class_list.get(module, [])
|
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:
|
for klass in class_list:
|
||||||
res.append(klass.createInstance(self, module, cr))
|
res.append(klass.createInstance(self, module, cr))
|
||||||
return res
|
return res
|
||||||
# else:
|
|
||||||
# print "skipping module", module
|
|
||||||
|
|
||||||
#pooler.get_pool(cr.dbname) = osv_pool()
|
|
||||||
|
|
||||||
class osv_memory(orm.orm_memory):
|
class osv_memory(orm.orm_memory):
|
||||||
#__metaclass__ = inheritor
|
#__metaclass__ = inheritor
|
||||||
|
@ -236,9 +228,6 @@ class osv(orm.orm):
|
||||||
parent_name = hasattr(cls, '_inherit') and cls._inherit
|
parent_name = hasattr(cls, '_inherit') and cls._inherit
|
||||||
if parent_name:
|
if parent_name:
|
||||||
parent_class = pool.get(parent_name).__class__
|
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)
|
assert pool.get(parent_name), "parent class %s does not exist in module %s !" % (parent_name, module)
|
||||||
nattr = {}
|
nattr = {}
|
||||||
for s in ('_columns', '_defaults', '_inherits', '_constraints', '_sql_constraints'):
|
for s in ('_columns', '_defaults', '_inherits', '_constraints', '_sql_constraints'):
|
||||||
|
|
|
@ -59,6 +59,7 @@ class fake_cursor:
|
||||||
self.dbname = dbname
|
self.dbname = dbname
|
||||||
|
|
||||||
def execute(self, sql, params=None):
|
def execute(self, sql, params=None):
|
||||||
|
print sql,params
|
||||||
if not params:
|
if not params:
|
||||||
params=()
|
params=()
|
||||||
def base_string(s):
|
def base_string(s):
|
||||||
|
|
Loading…
Reference in New Issue