From 3611f431b93e4bed0bfb8d360dc19cb2aa52778b Mon Sep 17 00:00:00 2001 From: "Kuldeep Joshi (OpenERP)" Date: Thu, 14 Jun 2012 11:34:50 +0530 Subject: [IMP]document: remove warning bzr revid: kjo@tinyerp.com-20120614060450-w8771020su128gmg --- addons/document/document_directory.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'addons/document') diff --git a/addons/document/document_directory.py b/addons/document/document_directory.py index d09d2cc86d5..9cc750b7c12 100644 --- a/addons/document/document_directory.py +++ b/addons/document/document_directory.py @@ -78,9 +78,8 @@ class document_directory(osv.osv): root_id = objid.read(cr, uid, mid, ['res_id'])['res_id'] return root_id except Exception, e: - import netsvc - logger = netsvc.Logger() - logger.notifyChannel("document", netsvc.LOG_WARNING, 'Cannot set directory root:'+ str(e)) + import logging + logging.getLogger('document').warning('Cannot set directory root:'+ str(e)) return False return objid.browse(cr, uid, mid, context=context).res_id -- cgit v1.2.3 From ceb22841d6b79db8be8d29597f2d624de5759abf Mon Sep 17 00:00:00 2001 From: "Foram Katharotiya (OpenERP)" Date: Mon, 18 Jun 2012 11:48:04 +0530 Subject: [IMP] add default data in document_data.xml bzr revid: fka@tinyerp.com-20120618061804-9i8ypqq2m8g7eab6 --- addons/document/document.py | 3 +-- addons/document/document_data.xml | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'addons/document') diff --git a/addons/document/document.py b/addons/document/document.py index 92ece063a47..6cd47569f0f 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -140,8 +140,7 @@ class document_file(osv.osv): _defaults = { 'user_id': lambda self, cr, uid, ctx:uid, - 'file_size': lambda self, cr, uid, ctx:0, - 'parent_id': __get_def_directory + 'file_size': lambda self, cr, uid, ctx:0 } _sql_constraints = [ # filename_uniq is not possible in pure SQL diff --git a/addons/document/document_data.xml b/addons/document/document_data.xml index ac7a174b05f..c8a6e304d1a 100644 --- a/addons/document/document_data.xml +++ b/addons/document/document_data.xml @@ -104,6 +104,10 @@ - + -- cgit v1.2.3 From 0c374a66bc3de5cdf48eb66b2078c0946aa045db Mon Sep 17 00:00:00 2001 From: "Foram Katharotiya (OpenERP)" Date: Fri, 22 Jun 2012 12:18:39 +0530 Subject: [IMP] Add logging at the top of python files bzr revid: fka@tinyerp.com-20120622064839-llitm8szgikxznwr --- addons/document/content_index.py | 17 +++++----- addons/document/document.py | 7 ++-- addons/document/document_directory.py | 8 ++--- addons/document/document_storage.py | 63 +++++++++++++++++------------------ addons/document/nodes.py | 29 ++++++++-------- addons/document/std_index.py | 7 ++-- 6 files changed, 67 insertions(+), 64 deletions(-) (limited to 'addons/document') diff --git a/addons/document/content_index.py b/addons/document/content_index.py index 64b480ee736..f24c033a7ec 100644 --- a/addons/document/content_index.py +++ b/addons/document/content_index.py @@ -22,7 +22,7 @@ import logging import os import tempfile from subprocess import Popen, PIPE - +_logger = logging.getLogger(__name__) class NhException(Exception): pass @@ -116,7 +116,7 @@ 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,8 +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 cntIndex = contentIndex() diff --git a/addons/document/document.py b/addons/document/document.py index 6cd47569f0f..1f584e08d83 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -30,11 +30,14 @@ from tools.translate import _ import nodes import logging +_loggerdoc = logging.getLogger(__name__) + DMS_ROOT_PATH = tools.config.get('document_path', os.path.join(tools.config['root_path'], 'filestore')) class document_file(osv.osv): _inherit = 'ir.attachment' _rec_name = 'datas_fname' + def _attach_parent_id(self, cr, uid, ids=None, context=None): """Migrate ir.attachments to the document module. @@ -54,7 +57,7 @@ class document_file(osv.osv): parent_id = self.pool.get('document.directory')._get_root_directory(cr,uid) if not parent_id: - logging.getLogger('document').warning("at _attach_parent_id(), still not able to set the parent!") + _loggerdoc.warning("at _attach_parent_id(), still not able to set the parent!") return False if ids is not None: @@ -335,7 +338,7 @@ class document_file(osv.osv): if r: unres.append(r) else: - logging.getLogger('document').warning("Unlinking attachment #%s %s that has no storage", + self.loggerdoc.warning("Unlinking attachment #%s %s that has no storage", f.id, f.name) res = super(document_file, self).unlink(cr, uid, ids, context) stor.do_unlink(cr, uid, unres) diff --git a/addons/document/document_directory.py b/addons/document/document_directory.py index 9cc750b7c12..d7d2e4763c7 100644 --- a/addons/document/document_directory.py +++ b/addons/document/document_directory.py @@ -22,10 +22,10 @@ from osv import osv, fields from osv.orm import except_orm - +import logging import nodes from tools.translate import _ - +_loggerdir = logging.getLogger(__name__) class document_directory(osv.osv): _name = 'document.directory' _description = 'Directory' @@ -78,8 +78,8 @@ class document_directory(osv.osv): root_id = objid.read(cr, uid, mid, ['res_id'])['res_id'] return root_id except Exception, e: - import logging - logging.getLogger('document').warning('Cannot set directory root:'+ str(e)) + + _loggerdir.warning('Cannot set directory root:'+ str(e)) return False return objid.browse(cr, uid, mid, context=context).res_id diff --git a/addons/document/document_storage.py b/addons/document/document_storage.py index fe757e7876d..9359d3245f3 100644 --- a/addons/document/document_storage.py +++ b/addons/document/document_storage.py @@ -29,18 +29,16 @@ import logging import shutil from StringIO import StringIO import psycopg2 - from tools.misc import ustr from tools.translate import _ - from osv.orm import except_orm - import random import string import pooler import nodes from content_index import cntIndex - +_logger = logging.getLogger(__name__) +_doclog = logging.getLogger(__name__) DMS_ROOT_PATH = tools.config.get('document_path', os.path.join(tools.config.get('root_path'), 'filestore')) @@ -130,7 +128,7 @@ class nodefd_file(nodes.node_descriptor): mime, icont = cntIndex.doIndex(None, filename=filename, content_type=None, realfname=fname) except Exception: - logging.getLogger('document.storage').debug('Cannot index file:', exc_info=True) + _logger.debug('Cannot index file:', exc_info=True) pass try: @@ -150,7 +148,7 @@ class nodefd_file(nodes.node_descriptor): cr.commit() cr.close() except Exception: - logging.getLogger('document.storage').warning('Cannot save file indexed content:', exc_info=True) + _logger.warning('Cannot save file indexed content:', exc_info=True) elif self.mode in ('a', 'a+' ): try: @@ -164,7 +162,7 @@ class nodefd_file(nodes.node_descriptor): cr.commit() cr.close() except Exception: - logging.getLogger('document.storage').warning('Cannot save file appended content:', exc_info=True) + _logger.warning('Cannot save file appended content:', exc_info=True) @@ -191,7 +189,7 @@ class nodefd_db(StringIO, nodes.node_descriptor): elif mode == 'a': StringIO.__init__(self, None) else: - logging.getLogger('document.storage').error("Incorrect mode %s specified", mode) + _logger.error("Incorrect mode %s specified", mode) raise IOError(errno.EINVAL, "Invalid file mode") self.mode = mode @@ -217,7 +215,7 @@ class nodefd_db(StringIO, nodes.node_descriptor): mime, icont = cntIndex.doIndex(data, filename=filename, content_type=None, realfname=None) except Exception: - logging.getLogger('document.storage').debug('Cannot index file:', exc_info=True) + _logger.debug('Cannot index file:', exc_info=True) pass try: @@ -241,7 +239,7 @@ class nodefd_db(StringIO, nodes.node_descriptor): (out, len(data), par.file_id)) cr.commit() except Exception: - logging.getLogger('document.storage').exception('Cannot update db file #%d for close:', par.file_id) + _logger.exception('Cannot update db file #%d for close:', par.file_id) raise finally: cr.close() @@ -271,7 +269,7 @@ class nodefd_db64(StringIO, nodes.node_descriptor): elif mode == 'a': StringIO.__init__(self, None) else: - logging.getLogger('document.storage').error("Incorrect mode %s specified", mode) + _logger.error("Incorrect mode %s specified", mode) raise IOError(errno.EINVAL, "Invalid file mode") self.mode = mode @@ -297,7 +295,7 @@ class nodefd_db64(StringIO, nodes.node_descriptor): mime, icont = cntIndex.doIndex(data, filename=filename, content_type=None, realfname=None) except Exception: - logging.getLogger('document.storage').debug('Cannot index file:', exc_info=True) + self.logger.debug('Cannot index file:', exc_info=True) pass try: @@ -320,7 +318,7 @@ class nodefd_db64(StringIO, nodes.node_descriptor): (base64.encodestring(data), len(data), par.file_id)) cr.commit() except Exception: - logging.getLogger('document.storage').exception('Cannot update db file #%d for close:', par.file_id) + _logger.exception('Cannot update db file #%d for close:', par.file_id) raise finally: cr.close() @@ -339,7 +337,6 @@ class document_storage(osv.osv): """ _name = 'document.storage' _description = 'Storage Media' - _doclog = logging.getLogger('document') _columns = { 'name': fields.char('Name', size=64, required=True, select=1), @@ -413,7 +410,7 @@ class document_storage(osv.osv): dpath += npath[:-1] path = os.path.join(*dpath) if not os.path.isdir(path): - self._doclog.debug("Create dirs: %s", path) + _doclog.debug("Create dirs: %s", path) os.makedirs(path) return path, npath @@ -451,7 +448,7 @@ class document_storage(osv.osv): # try to fix their directory. if mode in ('r','r+'): if ira.file_size: - self._doclog.warning( "ir.attachment #%d does not have a filename, but is at filestore, fix it!" % ira.id) + _doclog.warning( "ir.attachment #%d does not have a filename, but is at filestore, fix it!" % ira.id) raise IOError(errno.ENOENT, 'No file can be located') else: store_fname = self.__get_random_fname(boo.path) @@ -493,7 +490,7 @@ class document_storage(osv.osv): # On a migrated db, some files may have the wrong storage type # try to fix their directory. if ira.file_size: - self._doclog.warning( "ir.attachment #%d does not have a filename, but is at filestore, fix it!" % ira.id) + _doclog.warning( "ir.attachment #%d does not have a filename, but is at filestore, fix it!" % ira.id) return None fpath = os.path.join(boo.path, ira.store_fname) return file(fpath, 'rb').read() @@ -517,7 +514,7 @@ class document_storage(osv.osv): # On a migrated db, some files may have the wrong storage type # try to fix their directory. if ira.file_size: - self._doclog.warning("ir.attachment #%d does not have a filename, trying the name." %ira.id) + _doclog.warning("ir.attachment #%d does not have a filename, trying the name." %ira.id) # sfname = ira.name fpath = os.path.join(boo.path,ira.store_fname or ira.name) if os.path.exists(fpath): @@ -550,7 +547,7 @@ class document_storage(osv.osv): if boo.readonly: raise IOError(errno.EPERM, "Readonly medium") - self._doclog.debug( "Store data for ir.attachment #%d" % ira.id) + _doclog.debug( "Store data for ir.attachment #%d" % ira.id) store_fname = None fname = None if boo.type == 'filestore': @@ -563,13 +560,13 @@ class document_storage(osv.osv): fp.write(data) finally: fp.close() - self._doclog.debug( "Saved data to %s" % fname) + _doclog.debug( "Saved data to %s" % fname) filesize = len(data) # os.stat(fname).st_size # TODO Here, an old file would be left hanging. except Exception, e: - self._doclog.warning( "Couldn't save data to %s", path, exc_info=True) + _doclog.warning( "Couldn't save data to %s", path, exc_info=True) raise except_orm(_('Error!'), str(e)) elif boo.type == 'db': filesize = len(data) @@ -592,12 +589,12 @@ class document_storage(osv.osv): fp.write(data) finally: fp.close() - self._doclog.debug("Saved data to %s", fname) + _doclog.debug("Saved data to %s", fname) filesize = len(data) # os.stat(fname).st_size store_fname = os.path.join(*npath) # TODO Here, an old file would be left hanging. except Exception,e : - self._doclog.warning("Couldn't save data:", exc_info=True) + _doclog.warning("Couldn't save data:", exc_info=True) raise except_orm(_('Error!'), str(e)) elif boo.type == 'virtual': @@ -616,7 +613,7 @@ class document_storage(osv.osv): mime, icont = cntIndex.doIndex(data, ira.datas_fname, ira.file_type or None, fname) except Exception: - self._doclog.debug('Cannot index file:', exc_info=True) + _doclog.debug('Cannot index file:', exc_info=True) pass try: @@ -671,9 +668,9 @@ class document_storage(osv.osv): try: os.unlink(fname) except Exception: - self._doclog.warning("Could not remove file %s, please remove manually.", fname, exc_info=True) + _doclog.warning("Could not remove file %s, please remove manually.", fname, exc_info=True) else: - self._doclog.warning("Unknown unlink key %s" % ktype) + _doclog.warning("Unknown unlink key %s" % ktype) return True @@ -703,9 +700,9 @@ class document_storage(osv.osv): fname = ira.store_fname if not fname: - self._doclog.warning("Trying to rename a non-stored file") + _doclog.warning("Trying to rename a non-stored file") if fname != os.path.join(*npath): - self._doclog.warning("inconsistency in realstore: %s != %s" , fname, repr(npath)) + _doclog.warning("inconsistency in realstore: %s != %s" , fname, repr(npath)) oldpath = os.path.join(path, npath[-1]) newpath = os.path.join(path, new_name) @@ -743,7 +740,7 @@ class document_storage(osv.osv): break par = par.parent_id if file_node.storage_id != psto: - self._doclog.debug('Cannot move file %r from %r to %r', file_node, file_node.parent, ndir_bro.name) + _doclog.debug('Cannot move file %r from %r to %r', file_node, file_node.parent, ndir_bro.name) raise NotImplementedError('Cannot move files between storage media') if sbro.type in ('filestore', 'db', 'db64'): @@ -756,9 +753,9 @@ class document_storage(osv.osv): fname = ira.store_fname if not fname: - self._doclog.warning("Trying to rename a non-stored file") + _doclog.warning("Trying to rename a non-stored file") if fname != os.path.join(*opath): - self._doclog.warning("inconsistency in realstore: %s != %s" , fname, repr(opath)) + _doclog.warning("inconsistency in realstore: %s != %s" , fname, repr(opath)) oldpath = os.path.join(path, opath[-1]) @@ -766,12 +763,12 @@ class document_storage(osv.osv): npath = filter(lambda x: x is not None, npath) newdir = os.path.join(*npath) if not os.path.isdir(newdir): - self._doclog.debug("Must create dir %s", newdir) + _doclog.debug("Must create dir %s", newdir) os.makedirs(newdir) npath.append(opath[-1]) newpath = os.path.join(*npath) - self._doclog.debug("Going to move %s from %s to %s", opath[-1], oldpath, newpath) + _doclog.debug("Going to move %s from %s to %s", opath[-1], oldpath, newpath) shutil.move(oldpath, newpath) store_path = npath[1:] + [opath[-1],] diff --git a/addons/document/nodes.py b/addons/document/nodes.py index ee89f3d4c6c..5c3483e0785 100644 --- a/addons/document/nodes.py +++ b/addons/document/nodes.py @@ -41,8 +41,9 @@ from StringIO import StringIO # file: objct = ir.attachement # root: if we are at the first directory of a ressource # - -logger = logging.getLogger('doc2.nodes') +_nodefd = logging.getLogger(__name__) +_logger = logging.getLogger(__name__) +_loggernode = logging.getLogger(__name__) def _str2time(cre): """ Convert a string with time representation (from db) into time (float) @@ -328,7 +329,7 @@ class node_class(object): if self.DAV_M_NS.has_key(ns): prefix = self.DAV_M_NS[ns] else: - logger.debug('No namespace: %s ("%s")',ns, prop) + _logger.debug('No namespace: %s ("%s")',ns, prop) return None mname = prefix + "_" + prop.replace('-','_') @@ -341,7 +342,7 @@ class node_class(object): r = m(cr) return r except AttributeError: - logger.debug('Property %s not supported' % prop, exc_info=True) + _logger.debug('Property %s not supported' % prop, exc_info=True) return None def get_dav_resourcetype(self, cr): @@ -384,13 +385,13 @@ class node_class(object): def create_child(self, cr, path, data=None): """ Create a regular file under this node """ - logger.warning("Attempted to create a file under %r, not possible.", self) + _logger.warning("Attempted to create a file under %r, not possible.", self) raise IOError(errno.EPERM, "Not allowed to create files here") def create_child_collection(self, cr, objname): """ Create a child collection (directory) under self """ - logger.warning("Attempted to create a collection under %r, not possible.", self) + _logger.warning("Attempted to create a collection under %r, not possible.", self) raise IOError(errno.EPERM, "Not allowed to create folders here") def rm(self, cr): @@ -725,7 +726,7 @@ class node_dir(node_database): assert self.parent if self.parent != ndir_node: - logger.debug('Cannot move dir %r from %r to %r', self, self.parent, ndir_node) + _logger.debug('Cannot move dir %r from %r to %r', self, self.parent, ndir_node) raise NotImplementedError('Cannot move dir to another dir') ret = {} @@ -998,7 +999,7 @@ class node_res_obj(node_class): def get_dav_eprop_DEPR(self, cr, ns, prop): # Deprecated! if ns != 'http://groupdav.org/' or prop != 'resourcetype': - logger.warning("Who asked for %s:%s?" % (ns, prop)) + _logger.warning("Who asked for %s:%s?" % (ns, prop)) return None cntobj = self.context._dirobj.pool.get('document.directory.content') uid = self.context.uid @@ -1328,7 +1329,7 @@ class node_file(node_class): ret = {} if ndir_node and self.parent != ndir_node: if not (isinstance(self.parent, node_dir) and isinstance(ndir_node, node_dir)): - logger.debug('Cannot move file %r from %r to %r', self, self.parent, ndir_node) + _logger.debug('Cannot move file %r from %r to %r', self, self.parent, ndir_node) raise NotImplementedError('Cannot move files between dynamic folders') if not ndir_obj: @@ -1452,6 +1453,7 @@ class node_content(node_class): return '' class nodefd_content(StringIO, node_descriptor): + """ A descriptor to content nodes """ def __init__(self, parent, cr, mode, ctx): @@ -1473,7 +1475,7 @@ class nodefd_content(StringIO, node_descriptor): elif mode == 'a': StringIO.__init__(self, None) else: - logging.getLogger('document.content').error("Incorrect mode %s specified", mode) + _loggernode.error("Incorrect mode %s specified", mode) raise IOError(errno.EINVAL, "Invalid file mode") self.mode = mode @@ -1499,13 +1501,14 @@ class nodefd_content(StringIO, node_descriptor): raise NotImplementedError cr.commit() except Exception: - logging.getLogger('document.content').exception('Cannot update db content #%d for close:', par.cnt_id) + _loggernode.exception('Cannot update db content #%d for close:', par.cnt_id) raise finally: cr.close() StringIO.close(self) class nodefd_static(StringIO, node_descriptor): + """ A descriptor to nodes with static data. """ def __init__(self, parent, cr, mode, ctx=None): @@ -1526,7 +1529,7 @@ class nodefd_static(StringIO, node_descriptor): elif mode == 'a': StringIO.__init__(self, None) else: - logging.getLogger('document.nodes').error("Incorrect mode %s specified", mode) + _nodefd.error("Incorrect mode %s specified", mode) raise IOError(errno.EINVAL, "Invalid file mode") self.mode = mode @@ -1551,7 +1554,7 @@ class nodefd_static(StringIO, node_descriptor): raise NotImplementedError cr.commit() except Exception: - logging.getLogger('document.nodes').exception('Cannot update db content #%d for close:', par.cnt_id) + _nodefd.exception('Cannot update db content #%d for close:', par.cnt_id) raise finally: cr.close() diff --git a/addons/document/std_index.py b/addons/document/std_index.py index e153d018bf0..49ac9a5c906 100644 --- a/addons/document/std_index.py +++ b/addons/document/std_index.py @@ -25,6 +25,7 @@ import StringIO import odt2txt import sys, zipfile, xml.dom.minidom import logging +_logger = logging.getLogger(__name__) def _to_unicode(s): try: @@ -101,9 +102,9 @@ class DocIndex(indexer): (data, _) = pop.communicate() return _to_unicode(data) except OSError: - logger = logging.getLogger('document.DocIndex') - logger.warn("Failed attempt to execute antiword (MS Word reader). Antiword is necessary to index the file %s of MIME type %s. Detailed error available at DEBUG level.", fname, self._getMimeTypes()[0]) - logger.debug("Trace of the failed file indexing attempt: ", exc_info=True) + + _logger.warn("Failed attempt to execute antiword (MS Word reader). Antiword is necessary to index the file %s of MIME type %s. Detailed error available at DEBUG level.", fname, self._getMimeTypes()[0]) + _logger.debug("Trace of the failed file indexing attempt: ", exc_info=True) return False cntIndex.register(DocIndex()) -- cgit v1.2.3 From 87decf703a549d4f81d5742898066277d584c787 Mon Sep 17 00:00:00 2001 From: "Foram Katharotiya (OpenERP)" Date: Fri, 22 Jun 2012 12:55:45 +0530 Subject: [IMP] Add logging at the top of python files bzr revid: fka@tinyerp.com-20120622072545-uuok6zj2jm2koxw4 --- addons/document/document.py | 2 +- addons/document/document_storage.py | 17 ++++++++--------- addons/document/nodes.py | 10 ++++------ 3 files changed, 13 insertions(+), 16 deletions(-) (limited to 'addons/document') diff --git a/addons/document/document.py b/addons/document/document.py index 1f584e08d83..c213ca57549 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -38,7 +38,7 @@ class document_file(osv.osv): _inherit = 'ir.attachment' _rec_name = 'datas_fname' - + def _attach_parent_id(self, cr, uid, ids=None, context=None): """Migrate ir.attachments to the document module. diff --git a/addons/document/document_storage.py b/addons/document/document_storage.py index 9359d3245f3..a3a5e0db1fe 100644 --- a/addons/document/document_storage.py +++ b/addons/document/document_storage.py @@ -37,7 +37,6 @@ import string import pooler import nodes from content_index import cntIndex -_logger = logging.getLogger(__name__) _doclog = logging.getLogger(__name__) DMS_ROOT_PATH = tools.config.get('document_path', os.path.join(tools.config.get('root_path'), 'filestore')) @@ -128,7 +127,7 @@ class nodefd_file(nodes.node_descriptor): mime, icont = cntIndex.doIndex(None, filename=filename, content_type=None, realfname=fname) except Exception: - _logger.debug('Cannot index file:', exc_info=True) + _doclog.debug('Cannot index file:', exc_info=True) pass try: @@ -148,7 +147,7 @@ class nodefd_file(nodes.node_descriptor): cr.commit() cr.close() except Exception: - _logger.warning('Cannot save file indexed content:', exc_info=True) + _doclog.warning('Cannot save file indexed content:', exc_info=True) elif self.mode in ('a', 'a+' ): try: @@ -162,7 +161,7 @@ class nodefd_file(nodes.node_descriptor): cr.commit() cr.close() except Exception: - _logger.warning('Cannot save file appended content:', exc_info=True) + _doclog.warning('Cannot save file appended content:', exc_info=True) @@ -189,7 +188,7 @@ class nodefd_db(StringIO, nodes.node_descriptor): elif mode == 'a': StringIO.__init__(self, None) else: - _logger.error("Incorrect mode %s specified", mode) + _doclog.error("Incorrect mode %s specified", mode) raise IOError(errno.EINVAL, "Invalid file mode") self.mode = mode @@ -215,7 +214,7 @@ class nodefd_db(StringIO, nodes.node_descriptor): mime, icont = cntIndex.doIndex(data, filename=filename, content_type=None, realfname=None) except Exception: - _logger.debug('Cannot index file:', exc_info=True) + _doclog.debug('Cannot index file:', exc_info=True) pass try: @@ -239,7 +238,7 @@ class nodefd_db(StringIO, nodes.node_descriptor): (out, len(data), par.file_id)) cr.commit() except Exception: - _logger.exception('Cannot update db file #%d for close:', par.file_id) + _doclog.exception('Cannot update db file #%d for close:', par.file_id) raise finally: cr.close() @@ -269,7 +268,7 @@ class nodefd_db64(StringIO, nodes.node_descriptor): elif mode == 'a': StringIO.__init__(self, None) else: - _logger.error("Incorrect mode %s specified", mode) + _doclog.error("Incorrect mode %s specified", mode) raise IOError(errno.EINVAL, "Invalid file mode") self.mode = mode @@ -318,7 +317,7 @@ class nodefd_db64(StringIO, nodes.node_descriptor): (base64.encodestring(data), len(data), par.file_id)) cr.commit() except Exception: - _logger.exception('Cannot update db file #%d for close:', par.file_id) + _doclog.exception('Cannot update db file #%d for close:', par.file_id) raise finally: cr.close() diff --git a/addons/document/nodes.py b/addons/document/nodes.py index 5c3483e0785..273be7effa4 100644 --- a/addons/document/nodes.py +++ b/addons/document/nodes.py @@ -41,9 +41,7 @@ from StringIO import StringIO # file: objct = ir.attachement # root: if we are at the first directory of a ressource # -_nodefd = logging.getLogger(__name__) _logger = logging.getLogger(__name__) -_loggernode = logging.getLogger(__name__) def _str2time(cre): """ Convert a string with time representation (from db) into time (float) @@ -1475,7 +1473,7 @@ class nodefd_content(StringIO, node_descriptor): elif mode == 'a': StringIO.__init__(self, None) else: - _loggernode.error("Incorrect mode %s specified", mode) + _logger.error("Incorrect mode %s specified", mode) raise IOError(errno.EINVAL, "Invalid file mode") self.mode = mode @@ -1501,7 +1499,7 @@ class nodefd_content(StringIO, node_descriptor): raise NotImplementedError cr.commit() except Exception: - _loggernode.exception('Cannot update db content #%d for close:', par.cnt_id) + _logger.exception('Cannot update db content #%d for close:', par.cnt_id) raise finally: cr.close() @@ -1529,7 +1527,7 @@ class nodefd_static(StringIO, node_descriptor): elif mode == 'a': StringIO.__init__(self, None) else: - _nodefd.error("Incorrect mode %s specified", mode) + _logger.error("Incorrect mode %s specified", mode) raise IOError(errno.EINVAL, "Invalid file mode") self.mode = mode @@ -1554,7 +1552,7 @@ class nodefd_static(StringIO, node_descriptor): raise NotImplementedError cr.commit() except Exception: - _nodefd.exception('Cannot update db content #%d for close:', par.cnt_id) + _logger.exception('Cannot update db content #%d for close:', par.cnt_id) raise finally: cr.close() -- cgit v1.2.3 From 93b17b18540aaa2ebb33e2b89f0057c331d96671 Mon Sep 17 00:00:00 2001 From: Jigar Amin - OpenERP Date: Mon, 25 Jun 2012 10:52:04 +0530 Subject: [IMP/FIX] Imporved the Knoledge wizard no label issue and removed the action_skip button bzr revid: jam@tinyerp.com-20120625052204-ge7533h5n6wand0j --- addons/document/wizard/document_configuration_view.xml | 1 - 1 file changed, 1 deletion(-) (limited to 'addons/document') diff --git a/addons/document/wizard/document_configuration_view.xml b/addons/document/wizard/document_configuration_view.xml index 4a2f131d42a..d924e471aca 100644 --- a/addons/document/wizard/document_configuration_view.xml +++ b/addons/document/wizard/document_configuration_view.xml @@ -16,7 +16,6 @@