summaryrefslogtreecommitdiff
path: root/bin/tools/misc.py
diff options
context:
space:
mode:
authorVo Minh Thu <vmt@openerp.com>2011-01-26 15:42:55 +0100
committerVo Minh Thu <vmt@openerp.com>2011-01-26 15:42:55 +0100
commit0e39f07490d625f8720a1818cfe1a0f5aa4544e9 (patch)
treeab2184d0a7910a70a63b081cb94ee7372e862305 /bin/tools/misc.py
parent7bf401381db1ba2bbed032e394d9ae8a11fb180b (diff)
[IMP] tools/netsvc: removed direct dependency of tools on netsvc
bzr revid: vmt@openerp.com-20110126144255-t8p6g1ggjb7f1dmt
Diffstat (limited to 'bin/tools/misc.py')
-rw-r--r--bin/tools/misc.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/bin/tools/misc.py b/bin/tools/misc.py
index 615893ef238..26ed090edc8 100644
--- a/bin/tools/misc.py
+++ b/bin/tools/misc.py
@@ -55,7 +55,7 @@ try:
except ImportError:
html2text = None
-import netsvc
+import loglevels
from config import config
from lru import LRU
@@ -434,10 +434,10 @@ def _email_send(smtp_from, smtp_to_list, message, openobject_id=None, ssl=False,
"""
class WriteToLogger(object):
def __init__(self):
- self.logger = netsvc.Logger()
+ self.logger = loglevels.Logger()
def write(self, s):
- self.logger.notifyChannel('email_send', netsvc.LOG_DEBUG, s)
+ self.logger.notifyChannel('email_send', loglevels.LOG_DEBUG, s)
if openobject_id:
message['Message-Id'] = generate_tracking_message_id(openobject_id)
@@ -1094,7 +1094,7 @@ def logged(f):
vector.append(' result: %s' % pformat(res))
vector.append(' time delta: %s' % (time.time() - timeb4))
- netsvc.Logger().notifyChannel('logged', netsvc.LOG_DEBUG, '\n'.join(vector))
+ loglevels.Logger().notifyChannel('logged', loglevels.LOG_DEBUG, '\n'.join(vector))
return res
return wrapper
@@ -1300,7 +1300,7 @@ def detect_server_timezone():
try:
import pytz
except Exception:
- netsvc.Logger().notifyChannel("detect_server_timezone", netsvc.LOG_WARNING,
+ loglevels.Logger().notifyChannel("detect_server_timezone", loglevels.LOG_WARNING,
"Python pytz module is not available. Timezone will be set to UTC by default.")
return 'UTC'
@@ -1334,14 +1334,14 @@ def detect_server_timezone():
if value:
try:
tz = pytz.timezone(value)
- netsvc.Logger().notifyChannel("detect_server_timezone", netsvc.LOG_INFO,
+ loglevels.Logger().notifyChannel("detect_server_timezone", loglevels.LOG_INFO,
"Using timezone %s obtained from %s." % (tz.zone,source))
return value
except pytz.UnknownTimeZoneError:
- netsvc.Logger().notifyChannel("detect_server_timezone", netsvc.LOG_WARNING,
+ loglevels.Logger().notifyChannel("detect_server_timezone", loglevels.LOG_WARNING,
"The timezone specified in %s (%s) is invalid, ignoring it." % (source,value))
- netsvc.Logger().notifyChannel("detect_server_timezone", netsvc.LOG_WARNING,
+ loglevels.Logger().notifyChannel("detect_server_timezone", loglevels.LOG_WARNING,
"No valid timezone could be detected, using default UTC timezone. You can specify it explicitly with option 'timezone' in the server configuration.")
return 'UTC'