[MERGE] merged trunk.

bzr revid: vmt@openerp.com-20110516090036-d0yr21s1ofqu8tiq
This commit is contained in:
Vo Minh Thu 2011-05-16 11:00:36 +02:00
commit ffb6fdd3a9
4 changed files with 409 additions and 292 deletions

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,7 @@
##############################################################################
import time
import logging
from datetime import datetime
from dateutil.relativedelta import relativedelta
import netsvc
@ -91,10 +92,13 @@ class ir_cron(osv.osv, netsvc.Agent):
if m and hasattr(m, func):
f = getattr(m, func)
try:
netsvc.log('cron', (cr.dbname,uid,'*',model,func)+tuple(args), channel=logging.DEBUG,
depth=(None if self._logger.isEnabledFor(logging.DEBUG_RPC_ANSWER) else 1), fn='object.execute')
f(cr, uid, *args)
except Exception, e:
cr.rollback()
self._logger.exception("Job call of self.pool.get('%s').%s(cr, uid, *%r) failed" % (model, func, args))
logger=logging.getLogger('cron')
logger.exception("Job call of self.pool.get('%s').%s(cr, uid, *%r) failed" % (model, func, args))
def _poolJobs(self, db_name, check=False):

View File

@ -393,19 +393,22 @@ def replace_request_password(args):
args[2] = '*'
return args
class OpenERPDispatcher:
def log(self, title, msg, channel=logging.DEBUG_RPC, depth=None):
def log(title, msg, channel=logging.DEBUG_RPC, depth=None, fn=""):
logger = logging.getLogger(title)
if logger.isEnabledFor(channel):
for line in pformat(msg, depth=depth).split('\n'):
logger.log(channel, line)
indent=''
indent_after=' '*len(fn)
for line in (fn+pformat(msg, depth=depth)).split('\n'):
logger.log(channel, indent+line)
indent=indent_after
class OpenERPDispatcher:
def log(self, title, msg, channel=logging.DEBUG_RPC, depth=None, fn=""):
log(title, msg, channel=channel, depth=depth, fn=fn)
def dispatch(self, service_name, method, params):
try:
logger = logging.getLogger('result')
self.log('service', service_name)
self.log('method', method)
self.log('params', replace_request_password(params), depth=(None if logger.isEnabledFor(logging.DEBUG_RPC_ANSWER) else 1))
self.log('service', tuple(replace_request_password(params)), depth=(None if logger.isEnabledFor(logging.DEBUG_RPC_ANSWER) else 1), fn='%s.%s'%(service_name,method))
auth = getattr(self, 'auth_provider', None)
result = ExportService.getService(service_name).dispatch(method, auth, params)
self.log('result', result, channel=logging.DEBUG_RPC_ANSWER)

View File

@ -174,8 +174,14 @@ class YamlInterpreter(object):
else:
module = self.module
checked_xml_id = xml_id
try:
_, id = self.pool.get('ir.model.data').get_object_reference(self.cr, self.uid, module, checked_xml_id)
self.id_map[xml_id] = id
except ValueError, e:
raise ValueError("""%s not found when processing %s.
This Yaml file appears to depend on missing data. This often happens for
tests that belong to a module's test suite and depend on each other.""" % (checked_xml_id, self.filename))
return id
def get_context(self, node, eval_dict):