[IMP] openerp.service: remove the so called `uniform log handling` of the HttpLogHandler class.

bzr revid: vmt@openerp.com-20120124160231-1ig7utu5brojnw0f
This commit is contained in:
Vo Minh Thu 2012-01-24 17:02:31 +01:00
parent 0d25200483
commit cc081b5482
2 changed files with 5 additions and 21 deletions

View File

@ -62,27 +62,8 @@ except ImportError:
_logger = logging.getLogger(__name__)
class HttpLogHandler:
""" helper class for uniform log handling
Please define self._logger at each class that is derived from this
"""
_logger = None
def log_message(self, format, *args):
self._logger.debug(format % args) # todo: perhaps other level
class StaticHTTPHandler(FixSendError, HttpOptions, HTTPHandler):
def log_error(self, format, *args):
self._logger.error(format % args)
def log_exception(self, format, *args):
self._logger.exception(format, *args)
def log_request(self, code='-', size='-'):
self._logger.log(netsvc.logging.DEBUG_RPC, '"%s" %s %s',
self.requestline, str(code), str(size))
class StaticHTTPHandler(HttpLogHandler, FixSendError, HttpOptions, HTTPHandler):
_logger = logging.getLogger('httpd')
_HTTP_OPTIONS = { 'Allow': ['OPTIONS', 'GET', 'HEAD'] }
def __init__(self,request, client_address, server):

View File

@ -32,10 +32,13 @@
usable in other projects, too.
"""
import logging
import SocketServer
from BaseHTTPServer import *
from SimpleHTTPServer import SimpleHTTPRequestHandler
_logger = logging.getLogger(__name__)
class AuthRequiredExc(Exception):
def __init__(self,atype,realm):
Exception.__init__(self)
@ -176,7 +179,7 @@ class FixSendError:
if message is None:
message = short
explain = long
self.log_error("code %d, message %s", code, message)
_logger.error("code %d, message %s", code, message)
# using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201)
content = (self.error_message_format %
{'code': code, 'message': _quote_html(message), 'explain': explain})