[IMP] account,document: changed from class __logger to module _logger.
bzr revid: vmt@openerp.com-20120124162850-qr1or3piq9f91c7u
This commit is contained in:
parent
85f0ad1ea8
commit
7c4e08eb46
|
@ -31,10 +31,11 @@ from osv import fields, osv
|
|||
import netsvc
|
||||
import tools
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
class account_installer(osv.osv_memory):
|
||||
_name = 'account.installer'
|
||||
_inherit = 'res.config.installer'
|
||||
__logger = logging.getLogger(_name)
|
||||
|
||||
def _get_charts(self, cr, uid, context=None):
|
||||
modules = self.pool.get('ir.module.module')
|
||||
|
@ -142,7 +143,7 @@ class account_installer(osv.osv_memory):
|
|||
cr, uid, ids, context=context)
|
||||
chart = self.read(cr, uid, ids, ['charts'],
|
||||
context=context)[0]['charts']
|
||||
self.__logger.debug('Installing chart of accounts %s', chart)
|
||||
_logger.debug('Installing chart of accounts %s', chart)
|
||||
return modules | set([chart])
|
||||
|
||||
account_installer()
|
||||
|
|
|
@ -23,10 +23,11 @@ import os
|
|||
import tempfile
|
||||
from subprocess import Popen, PIPE
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
class NhException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class indexer(object):
|
||||
""" An indexer knows how to parse the content of some file.
|
||||
|
||||
|
@ -116,7 +117,6 @@ def mime_match(mime, mdict):
|
|||
return (None, None)
|
||||
|
||||
class contentIndex(object):
|
||||
__logger = logging.getLogger('addons.document.content_index')
|
||||
def __init__(self):
|
||||
self.mimes = {}
|
||||
self.exts = {}
|
||||
|
@ -132,7 +132,7 @@ class contentIndex(object):
|
|||
f = True
|
||||
|
||||
if f:
|
||||
self.__logger.debug('Register content indexer: %r', obj)
|
||||
_logger.debug('Register content indexer: %r', obj)
|
||||
if not f:
|
||||
raise Exception("Your indexer should at least suport a mimetype or extension")
|
||||
|
||||
|
@ -169,22 +169,22 @@ class contentIndex(object):
|
|||
(result, _) = pop.communicate()
|
||||
|
||||
mime2 = result.split(';')[0]
|
||||
self.__logger.debug('File gave us: %s', mime2)
|
||||
_logger.debug('File gave us: %s', mime2)
|
||||
# Note that the temporary file still exists now.
|
||||
mime,fobj = mime_match(mime2, self.mimes)
|
||||
if not mime:
|
||||
mime = mime2
|
||||
except Exception:
|
||||
self.__logger.exception('Cannot determine mime type')
|
||||
_logger.exception('Cannot determine mime type')
|
||||
|
||||
try:
|
||||
if fobj:
|
||||
res = (mime, fobj.indexContent(content,filename,fname or realfname) )
|
||||
else:
|
||||
self.__logger.debug("Have no object, return (%s, None)", mime)
|
||||
_logger.debug("Have no object, return (%s, None)", mime)
|
||||
res = (mime, None )
|
||||
except Exception:
|
||||
self.__logger.exception("Could not index file %s (%s)",
|
||||
_logger.exception("Could not index file %s (%s)",
|
||||
filename, fname or realfname)
|
||||
res = None
|
||||
|
||||
|
@ -193,7 +193,7 @@ class contentIndex(object):
|
|||
try:
|
||||
os.unlink(fname)
|
||||
except Exception:
|
||||
self.__logger.exception("Could not unlink %s", fname)
|
||||
_logger.exception("Could not unlink %s", fname)
|
||||
|
||||
return res
|
||||
|
||||
|
|
Loading…
Reference in New Issue