[MERGE] server: remove unused imports (Thanks to Florent Xicluna)
bzr revid: stw@openerp.com-20120910144609-ad3gupkf3oseb8yy
This commit is contained in:
commit
f55028de4d
|
@ -30,7 +30,6 @@ GNU Public Licence.
|
||||||
(c) 2003-TODAY, Fabien Pinckaers - OpenERP SA
|
(c) 2003-TODAY, Fabien Pinckaers - OpenERP SA
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import imp
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import signal
|
import signal
|
||||||
|
@ -203,7 +202,7 @@ def quit_on_signals():
|
||||||
try:
|
try:
|
||||||
while quit_signals_received == 0:
|
while quit_signals_received == 0:
|
||||||
time.sleep(60)
|
time.sleep(60)
|
||||||
except KeyboardInterrupt, e:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if config['pidfile']:
|
if config['pidfile']:
|
||||||
|
|
|
@ -1308,7 +1308,7 @@ class BaseModel(object):
|
||||||
if not line[i]:
|
if not line[i]:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if field[:len(prefix)] <> prefix:
|
if field[:len(prefix)] != prefix:
|
||||||
if line[i] and skip:
|
if line[i] and skip:
|
||||||
return False
|
return False
|
||||||
continue
|
continue
|
||||||
|
@ -2709,7 +2709,7 @@ class BaseModel(object):
|
||||||
# if val is a many2one, just write the ID
|
# if val is a many2one, just write the ID
|
||||||
if type(val) == tuple:
|
if type(val) == tuple:
|
||||||
val = val[0]
|
val = val[0]
|
||||||
if (val<>False) or (type(val)<>bool):
|
if val is not False:
|
||||||
cr.execute(update_query, (ss[1](val), key))
|
cr.execute(update_query, (ss[1](val), key))
|
||||||
|
|
||||||
def _check_selection_field_value(self, cr, uid, field, value, context=None):
|
def _check_selection_field_value(self, cr, uid, field, value, context=None):
|
||||||
|
|
|
@ -44,10 +44,8 @@ import posixpath
|
||||||
import urllib
|
import urllib
|
||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
from SimpleXMLRPCServer import SimpleXMLRPCDispatcher
|
|
||||||
|
|
||||||
from websrv_lib import *
|
from websrv_lib import *
|
||||||
import openerp.netsvc as netsvc
|
|
||||||
import openerp.tools as tools
|
import openerp.tools as tools
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -131,7 +131,7 @@ class TinySocketServerThread(threading.Thread,netsvc.Server):
|
||||||
_logger.debug("Netrpc: %d threads", len(self.threads))
|
_logger.debug("Netrpc: %d threads", len(self.threads))
|
||||||
self.socket.close()
|
self.socket.close()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
_logger.warning("Netrpc: closing because of exception %s" % str(e))
|
_logger.warning("Netrpc: closing because of exception %s", e)
|
||||||
self.socket.close()
|
self.socket.close()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
|
@ -238,9 +238,9 @@ class db(netsvc.ExportService):
|
||||||
|
|
||||||
if not data or res:
|
if not data or res:
|
||||||
_logger.error(
|
_logger.error(
|
||||||
'DUMP DB: %s failed! Please verify the configuration of the database password on the server. '\
|
'DUMP DB: %s failed! Please verify the configuration of the database password on the server. '
|
||||||
'It should be provided as a -w <PASSWD> command-line option, or as `db_password` in the '\
|
'It should be provided as a -w <PASSWD> command-line option, or as `db_password` in the '
|
||||||
'server configuration file.\n %s' % (db_name, data))
|
'server configuration file.\n %s', db_name, data)
|
||||||
raise Exception, "Couldn't dump database"
|
raise Exception, "Couldn't dump database"
|
||||||
_logger.info('DUMP DB successful: %s', db_name)
|
_logger.info('DUMP DB successful: %s', db_name)
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ class db(netsvc.ExportService):
|
||||||
self._set_pg_psw_env_var()
|
self._set_pg_psw_env_var()
|
||||||
|
|
||||||
if self.exp_db_exist(db_name):
|
if self.exp_db_exist(db_name):
|
||||||
_logger.warning('RESTORE DB: %s already exists' % (db_name,))
|
_logger.warning('RESTORE DB: %s already exists', db_name)
|
||||||
raise Exception, "Database already exists"
|
raise Exception, "Database already exists"
|
||||||
|
|
||||||
self._create_empty_database(db_name)
|
self._create_empty_database(db_name)
|
||||||
|
@ -282,7 +282,7 @@ class db(netsvc.ExportService):
|
||||||
res = stdout.close()
|
res = stdout.close()
|
||||||
if res:
|
if res:
|
||||||
raise Exception, "Couldn't restore database"
|
raise Exception, "Couldn't restore database"
|
||||||
_logger.info('RESTORE DB: %s' % (db_name))
|
_logger.info('RESTORE DB: %s', db_name)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
finally:
|
finally:
|
||||||
|
@ -465,8 +465,7 @@ GNU Public Licence.
|
||||||
|
|
||||||
backup_directory = os.path.join(tools.config['root_path'], 'backup', time.strftime('%Y-%m-%d-%H-%M'))
|
backup_directory = os.path.join(tools.config['root_path'], 'backup', time.strftime('%Y-%m-%d-%H-%M'))
|
||||||
if zips and not os.path.isdir(backup_directory):
|
if zips and not os.path.isdir(backup_directory):
|
||||||
_logger.info('create a new backup directory to \
|
_logger.info('create a new backup directory to store the old modules: %s', backup_directory)
|
||||||
store the old modules: %s', backup_directory)
|
|
||||||
os.makedirs(backup_directory)
|
os.makedirs(backup_directory)
|
||||||
|
|
||||||
for module in zips:
|
for module in zips:
|
||||||
|
@ -695,7 +694,7 @@ class report_spool(netsvc.ExportService):
|
||||||
self._reports[id]['state'] = True
|
self._reports[id]['state'] = True
|
||||||
except Exception, exception:
|
except Exception, exception:
|
||||||
|
|
||||||
_logger.exception('Exception: %s\n', str(exception))
|
_logger.exception('Exception: %s\n', exception)
|
||||||
if hasattr(exception, 'name') and hasattr(exception, 'value'):
|
if hasattr(exception, 'name') and hasattr(exception, 'value'):
|
||||||
self._reports[id]['exception'] = openerp.exceptions.DeferredException(tools.ustr(exception.name), tools.ustr(exception.value))
|
self._reports[id]['exception'] = openerp.exceptions.DeferredException(tools.ustr(exception.name), tools.ustr(exception.value))
|
||||||
else:
|
else:
|
||||||
|
@ -732,7 +731,7 @@ class report_spool(netsvc.ExportService):
|
||||||
self._reports[id]['format'] = format
|
self._reports[id]['format'] = format
|
||||||
self._reports[id]['state'] = True
|
self._reports[id]['state'] = True
|
||||||
except Exception, exception:
|
except Exception, exception:
|
||||||
_logger.exception('Exception: %s\n', str(exception))
|
_logger.exception('Exception: %s\n', exception)
|
||||||
if hasattr(exception, 'name') and hasattr(exception, 'value'):
|
if hasattr(exception, 'name') and hasattr(exception, 'value'):
|
||||||
self._reports[id]['exception'] = openerp.exceptions.DeferredException(tools.ustr(exception.name), tools.ustr(exception.value))
|
self._reports[id]['exception'] = openerp.exceptions.DeferredException(tools.ustr(exception.name), tools.ustr(exception.value))
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -27,7 +27,6 @@ class m(openerp.osv.osv.Model):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def consume_cpu_time(self, cr, uid, seconds, context=None):
|
def consume_cpu_time(self, cr, uid, seconds, context=None):
|
||||||
import os
|
|
||||||
t0 = time.clock()
|
t0 = time.clock()
|
||||||
t1 = time.clock()
|
t1 = time.clock()
|
||||||
while t1 - t0 < seconds:
|
while t1 - t0 < seconds:
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import os
|
|
||||||
import unittest2
|
import unittest2
|
||||||
|
|
||||||
import openerp
|
import openerp
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
import socket
|
import socket
|
||||||
import cPickle
|
import cPickle
|
||||||
import cStringIO
|
import cStringIO
|
||||||
import marshal
|
|
||||||
|
|
||||||
import netsvc
|
import netsvc
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ import openerp.pooler as pooler
|
||||||
|
|
||||||
from openerp.osv.osv import except_osv
|
from openerp.osv.osv import except_osv
|
||||||
from openerp.osv.orm import except_orm
|
from openerp.osv.orm import except_orm
|
||||||
import sys
|
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -168,10 +167,7 @@ class interface(netsvc.Service):
|
||||||
or isinstance(e, except_orm):
|
or isinstance(e, except_orm):
|
||||||
netsvc.abort_response(2, e.name, 'warning', e.value)
|
netsvc.abort_response(2, e.name, 'warning', e.value)
|
||||||
else:
|
else:
|
||||||
import traceback
|
_logger.exception('Exception in call:')
|
||||||
tb_s = reduce(lambda x, y: x+y, traceback.format_exception(
|
|
||||||
sys.exc_type, sys.exc_value, sys.exc_traceback))
|
|
||||||
_logger.error('Exception in call: ' + tb_s)
|
|
||||||
raise
|
raise
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
Loading…
Reference in New Issue