from .. import utils
-
-
-_logger = logging.getLogger('web.auth_openid')
-oidutil.log = logging.getLogger('openid').debug
-
+oidutil.log = logging.getLogger(__name__ + '(oidutil)').debug
class GoogleAppsAwareConsumer(consumer.GenericConsumer):
def complete(self, message, endpoint, return_to):
# Boston, MA 02111-1307
# USA.
+import logging
from random import seed, sample
from string import ascii_letters, digits
from osv import fields,osv
from tools.translate import _
from service import security
+_logger = logging.getLogger(__name__)
+
magic_md5 = '$1$'
def gen_salt( length=8, symbols=ascii_letters + digits ):
cr = pooler.get_db(db).cursor()
return self._login(cr, db, login, password)
except Exception:
- import logging
- logging.getLogger('netsvc').exception('Could not authenticate')
+ _logger.exception('Could not authenticate')
return Exception('Access Denied')
finally:
if cr is not None:
#
##############################################################################
+import logging
import os
import addons
from tools.translate import _
from base_module_quality import base_module_quality
+_logger = logging.getLogger(__name__)
+
class quality_test(base_module_quality.abstract_quality_check):
def __init__(self):
res = os.popen('pylint --rcfile=' + config_file_path + ' ' + file_path).read()
except Exception:
self.error = True
- self.log.exception("Cannot run pylint test for %s", file_path)
+ _logger.exception("Cannot run pylint test for %s", file_path)
self.result += _("Error. Is pylint correctly installed? (http://pypi.python.org/pypi/pylint)")+"\n"
return None
count += 1
score += float(scr)
dict_py[file_py] = [file_py, scr]
except Exception:
- self.log.warning("Cannot parse pylint result", exc_info=True)
+ _logger.warning("Cannot parse pylint result", exc_info=True)
score += 0
dict_py[file_py] = [file_py, _("Unable to parse the result. Check the details.")]
replace_string = ''
#
##############################################################################
+import logging
+
from tools.translate import _
import pooler
+_logger = logging.getLogger(__name__)
+
from base_module_quality import base_module_quality
class CounterCursor(object):
try:
obj_ids = self.get_ids(cr, uid, obj_list)
except Exception,e:
- self.log.warning("Cannot get ids:", exc_info=True)
+ _logger.warning("Cannot get ids:", exc_info=True)
obj_ids= {}
self.result_details += e.message
result_dict = {}
code_size_complexity = ccr.count
except Exception, e:
- self.log.warning('Error in read method', exc_info=True)
+ _logger.warning('Error in read method', exc_info=True)
list2 = [obj, _("Error in Read method")]
speed_list = [obj, size, code_base_complexity, code_half_complexity, code_size_complexity, _("Error in Read method: %s") % e]
else:
#
##############################################################################
+import loggging
import xml.dom.minidom
import tools
from base_module_quality import base_module_quality
import pooler
+_logger = logging.getLogger(__name__)
+
class quality_test(base_module_quality.abstract_quality_check):
def __init__(self):
#Activity of workflow checking...
activity_ids = wkf_activity_obj.search(cr, uid, [('wkf_id', 'in', wkf_ids)])
activities = wkf_activity_obj.browse(cr, uid, activity_ids)
- self.log.debug("quality test: wkf_ids = %r", wkf_ids)
- self.log.debug("quality test: activity_ids = %r", activity_ids)
+ _logger.debug("quality test: wkf_ids = %r", wkf_ids)
+ _logger.debug("quality test: activity_ids = %r", activity_ids)
for activity in activities:
if activity.flow_start:
activity_chk[activity.wkf_id.osv]['start'] = 'ok'
count = self.count_button(node, count)
return count
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
#
##############################################################################
-import logging
import string
import datetime
import re
try:
import vatnumber
except ImportError:
- logging.getLogger('base_vat').warning("VAT validation partially unavailable because the `vatnumber` Python library cannot be found. "
+ import logging
+ logging.getLogger(__name__).warning("VAT validation partially unavailable because the `vatnumber` Python library cannot be found. "
"Install it to support more countries, for example with `easy_install vatnumber`.")
vatnumber = None
except ImportError:
from document.dict_tools import dict_merge2
+_logger = logging.getLogger(__name__)
+
# TODO: implement DAV-aware errors, inherit from IOError
# Assuming that we have set global properties right, we mark *all*
res = []
if not filters:
return res
- _log = logging.getLogger('caldav.query')
if filters.localName == 'calendar-query':
res = []
for filter_child in filters.childNodes:
for cfe in vevent_filter.childNodes:
if cfe.localName == 'time-range':
if cfe.getAttribute('start'):
- _log.warning("Ignore start.. ")
+ _logger.warning("Ignore start.. ")
# No, it won't work in this API
#val = cfe.getAttribute('start')
#res += [('dtstart','=', cfe)]
elif cfe.getAttribute('end'):
- _log.warning("Ignore end.. ")
+ _logger.warning("Ignore end.. ")
else:
- _log.debug("Unknown comp-filter: %s", cfe.localName)
+ _logger.debug("Unknown comp-filter: %s", cfe.localName)
else:
- _log.debug("Unknown comp-filter: %s", vevent_filter.localName)
+ _logger.debug("Unknown comp-filter: %s", vevent_filter.localName)
else:
- _log.debug("Unknown filter element: %s", vcalendar_filter.localName)
+ _logger.debug("Unknown filter element: %s", vcalendar_filter.localName)
else:
- _log.debug("Unknown calendar-query element: %s", filter_child.localName)
+ _logger.debug("Unknown calendar-query element: %s", filter_child.localName)
return res
elif filters.localName == 'calendar-multiget':
# this is not the place to process, as it wouldn't support multi-level
# hrefs. So, the code is moved to document_webdav/dav_fs.py
pass
else:
- _log.debug("Unknown element in REPORT: %s", filters.localName)
+ _logger.debug("Unknown element in REPORT: %s", filters.localName)
return res
def children(self, cr, domain=None):
except ImportError:
raise osv.except_osv(_('vobject Import Error!'), _('Please install python-vobject from http://vobject.skyhouseconsulting.com/'))
+_logger = logging.getLogger(__name__)
+
# O-1 Optional and can come only once
# O-n Optional and can come more than once
# R-1 Required and can come only once
class CalDAV(object):
__attribute__ = {}
- _logger = logging.getLogger('document.caldav')
def ical_set(self, name, value, type):
""" set calendar Attribute
objs.append(cal_children[child.name.lower()])
elif child.name.upper() == 'CALSCALE':
if child.value.upper() != 'GREGORIAN':
- self._logger.warning('How do I handle %s calendars?',child.value)
+ _logger.warning('How do I handle %s calendars?',child.value)
elif child.name.upper() in ('PRODID', 'VERSION'):
pass
elif child.name.upper().startswith('X-'):
- self._logger.debug("skipping custom node %s", child.name)
+ _logger.debug("skipping custom node %s", child.name)
else:
- self._logger.debug("skipping node %s", child.name)
+ _logger.debug("skipping node %s", child.name)
res = []
for obj_name in list(set(objs)):
import caldav_node
import logging
+_logger = logging.getLogger(__name__)
+
class calendar_collection(osv.osv):
_inherit = 'document.directory'
_columns = {
root_cal_dir = self.browse(cr,uid, root_id, context=context)
return root_cal_dir.name
except Exception:
- logger = logging.getLogger('document')
- logger.warning('Cannot set root directory for Calendars:', exc_info=True)
+ _logger.warning('Cannot set root directory for Calendars:', exc_info=True)
return False
return False
from tools.translate import _
import logging
+_logger = logging.getLogger(__name__)
+
class crm_lead(crm_case, osv.osv):
""" CRM Leads """
_name = 'crm.lead'
'user_id': user_id}, context=context)
except:
# Tolerate a missing shortcut. See product/product.py for similar code.
- logging.getLogger('orm').debug('Skipped meetings shortcut for user "%s"', data.get('name','<new'))
+ _logger.debug('Skipped meetings shortcut for user "%s"', data.get('name','<new'))
return user_id
res_users()
from ftpserver import _to_decode, _to_unicode
+_logger = logging.getLogger(__name__)
class abstracted_fs(object):
"""A class used to interact with the file system, providing a high
self.cwd = '/'
self.cwd_node = None
self.rnfr = None
- self._log = logging.getLogger('FTP.fs')
# Ok
def db_list(self):
self.db_name_list.append(db_name)
cr.commit()
except Exception:
- self._log.warning('Cannot use db "%s"', db_name)
+ _logger.warning('Cannot use db "%s"', db_name)
finally:
if cr is not None:
cr.close()
except EnvironmentError:
raise
except Exception:
- self._log.exception('Cannot locate item %s at node %s', objname, repr(node))
+ _logger.exception('Cannot locate item %s at node %s', objname, repr(node))
pass
try:
except EnvironmentError:
raise
except Exception:
- self._log.exception('Cannot create item %s at node %s', objname, repr(node))
+ _logger.exception('Cannot create item %s at node %s', objname, repr(node))
raise OSError(1, 'Operation not permited.')
def open(self, datacr, mode):
try:
basename =_to_unicode(basename)
cdir = node.create_child_collection(cr, basename)
- self._log.debug("Created child dir: %r", cdir)
+ _logger.debug("Created child dir: %r", cdir)
cr.commit()
except Exception:
- self._log.exception('Cannot create dir "%s" at node %s', basename, repr(node))
+ _logger.exception('Cannot create dir "%s" at node %s', basename, repr(node))
raise OSError(1, 'Operation not permited.')
def close_cr(self, data):
# we have to start from root, again
while p_parts and p_parts[0] == '':
p_parts = p_parts[1:]
- # self._log.debug("Path parts: %r ", p_parts)
+ # _logger.debug("Path parts: %r ", p_parts)
if not p_parts:
raise IOError(errno.EPERM, 'Cannot perform operation at root dir')
dbname = p_parts[0]
except EnvironmentError:
raise
except Exception:
- self._log.exception('Cannot rename "%s" to "%s" at "%s"', src, datacr[2], datacr[1])
+ _logger.exception('Cannot rename "%s" to "%s" at "%s"', src, datacr[2], datacr[1])
raise OSError(1,'Operation not permited.')
def stat(self, node):
import StringIO
import base64
-log = logging.getLogger('http-client')
+_logger = logging.getLogger(__name__)
class HTTP11(httplib.HTTP):
_http_vsn = 11
def __init__(self, use_datetime=0):
self._use_datetime = use_datetime
self._http = {}
- log.debug("Using persistent transport")
+ _logger.debug("Using persistent transport")
def make_connection(self, host):
# create a HTTP connection object from a host descriptor
if not self._http.has_key(host):
host, extra_headers, x509 = self.get_host_info(host)
self._http[host] = HTTP11(host)
- log.debug("New connection to %s", host)
+ _logger.debug("New connection to %s", host)
return self._http[host]
def get_host_info(self, host):
if not self._http.has_key(host):
host, extra_headers, x509 = self.get_host_info(host)
self._http[host] = httplib.HTTPS(host, None, **(x509 or {}))
- log.debug("New connection to %s", host)
+ _logger.debug("New connection to %s", host)
return self._http[host]
class AuthClient(object):
return super(BasicAuthClient,self).getAuth(atype, realm)
if not self._realm_dict.has_key(realm):
- log.debug("realm dict: %r", self._realm_dict)
- log.debug("missing key: \"%s\"" % realm)
+ _logger.debug("realm dict: %r", self._realm_dict)
+ _logger.debug("missing key: \"%s\"" % realm)
self.resolveFailedRealm(realm)
return 'Basic '+ self._realm_dict[realm]
# This line will bork if self.setAuthClient has not
# been issued. That is a programming error, fix your code!
auths = self._auth_client.getAuth(atype, realm)
- log.debug("sending authorization: %s", auths)
+ _logger.debug("sending authorization: %s", auths)
h.putheader('Authorization', auths)
self.send_content(h, request_body)
(atype,realm) = resp.msg.getheader('www-authenticate').split(' ',1)
data1 = resp.read()
if data1:
- log.warning("Why have data on a 401 auth. message?")
+ _logger.warning("Why have data on a 401 auth. message?")
if realm.startswith('realm="') and realm.endswith('"'):
realm = realm[7:-1]
- log.debug("Resp: %r %r", resp.version,resp.isclosed(), resp.will_close)
- log.debug("Want to do auth %s for realm %s", atype, realm)
+ _logger.debug("Resp: %r %r", resp.version,resp.isclosed(), resp.will_close)
+ _logger.debug("Want to do auth %s for realm %s", atype, realm)
if atype != 'Basic':
raise ProtocolError(host+handler, 403,
"Unknown authentication method: %s" % atype, resp.msg)
lf = (len(ssl.PEM_FOOTER)+1)
if cert[0-lf] != '\n':
cert = cert[:0-lf]+'\n'+cert[0-lf:]
- log.debug("len-footer: %s cert: %r", lf, cert[0-lf])
+ _logger.debug("len-footer: %s cert: %r", lf, cert[0-lf])
return cert
import base64
dbg = self.dbg
hdrs.update(self.hdrs)
- log.debug("Getting %s http://%s:%d/%s", method, self.host, self.port, path)
+ _logger.debug("Getting %s http://%s:%d/%s", method, self.host, self.port, path)
conn = httplib.HTTPConnection(self.host, port=self.port, timeout=self.timeout)
conn.set_debuglevel(dbg)
if not path:
try:
r1 = conn.getresponse()
except httplib.BadStatusLine, bsl:
- log.warning("Bad status line: %s", bsl.line)
+ _logger.warning("Bad status line: %s", bsl.line)
raise Exception('Bad status line')
if r1.status == 401: # and r1.headers:
if 'www-authenticate' in r1.msg:
data1 = r1.read()
if not self.user:
raise Exception('Must auth, have no user/pass!')
- log.debug("Ver: %s, closed: %s, will close: %s", r1.version,r1.isclosed(), r1.will_close)
- log.debug("Want to do auth %s for realm %s", atype, realm)
+ _logger.debug("Ver: %s, closed: %s, will close: %s", r1.version,r1.isclosed(), r1.will_close)
+ _logger.debug("Want to do auth %s for realm %s", atype, realm)
if atype == 'Basic' :
auths = base64.encodestring(self.user + ':' + self.passwd)
if auths[-1] == "\n":
else:
raise Exception("Unknown auth type %s" %atype)
else:
- log.warning("Got 401, cannot auth")
+ _logger.warning("Got 401, cannot auth")
raise Exception('No auth')
- log.debug("Reponse: %s %s",r1.status, r1.reason)
+ _logger.debug("Reponse: %s %s",r1.status, r1.reason)
data1 = r1.read()
if method != 'GET':
- log.debug("Body:\n%s\nEnd of body", data1)
+ _logger.debug("Body:\n%s\nEnd of body", data1)
try:
ctype = r1.msg.getheader('content-type')
if ctype and ';' in ctype:
ctype, encoding = ctype.split(';',1)
if ctype == 'text/xml':
doc = xml.dom.minidom.parseString(data1)
- log.debug("XML Body:\n %s", doc.toprettyxml(indent="\t"))
+ _logger.debug("XML Body:\n %s", doc.toprettyxml(indent="\t"))
except Exception:
- log.warning("could not print xml", exc_info=True)
+ _logger.warning("could not print xml", exc_info=True)
pass
conn.close()
return r1.status, r1.msg, data1
s, m, d = self._http_request(path, method='OPTIONS', hdrs=hdrs)
assert s == 200, "Status: %r" % s
assert 'OPTIONS' in m.getheader('Allow')
- log.debug('Options: %r', m.getheader('Allow'))
+ _logger.debug('Options: %r', m.getheader('Allow'))
if expect:
self._assert_headers(expect, m)
for cnod in node.childNodes:
if cnod.nodeType != node.ELEMENT_NODE:
if strict:
- log.debug("Found %r inside <%s>", cnod, node.tagName)
+ _logger.debug("Found %r inside <%s>", cnod, node.tagName)
continue
if namespaces and (cnod.namespaceURI not in namespaces):
- log.debug("Ignoring <%s> in <%s>", cnod.tagName, node.localName)
+ _logger.debug("Ignoring <%s> in <%s>", cnod.tagName, node.localName)
continue
yield cnod
assert htver == 'HTTP/1.1'
rstatus = int(sta)
else:
- log.debug("What is <%s> inside a <propstat>?", pno.tagName)
+ _logger.debug("What is <%s> inside a <propstat>?", pno.tagName)
else:
- log.debug("Unknown node: %s", cno.tagName)
+ _logger.debug("Unknown node: %s", cno.tagName)
res.setdefault(href,[]).append((status, res_nss))
if lsp[1] in davprops:
lsline[lsp[0]] = lsp[2]
else:
- log.debug("Strange status: %s", st)
+ _logger.debug("Strange status: %s", st)
res.append(lsline)
from tools.translate import _
from urllib import quote as quote
+_logger = logging.getLogger(__name__)
+
try:
from mako.template import Template as MakoTemplate
except ImportError:
- logging.getLogger('init').warning("email_template: mako templates not available, templating features will not work!")
+ _logger.warning("email_template: mako templates not available, templating features will not work!")
class email_template(osv.osv):
"Templates for sending email"
result = u''
return result
except Exception:
- logging.exception("failed to render mako template value %r", template)
+ _logger.exception("failed to render mako template value %r", template)
return u""
def get_email_template(self, cr, uid, template_id=False, record_id=None, context=None):
import logging
import addons
+_logger = logging.getLogger(__name__)
+
class hr_employee_category(osv.osv):
def name_get(self, cr, uid, ids, context=None):
'user_id': user_id}, context=context)
except:
# Tolerate a missing shortcut. See product/product.py for similar code.
- logging.getLogger('orm').debug('Skipped meetings shortcut for user "%s"', data.get('name','<new'))
+ _logger.debug('Skipped meetings shortcut for user "%s"', data.get('name','<new'))
return user_id
import sys
+_logger = logging.getLogger(__name__)
debug = False
-
class LoginError(Exception): pass
def login(username, password, url):
email_list.append(list.Email_address)
return email_list
except Exception,e:
- logging.getLogger('sugarcrm_soap').error('Exception: %s\n' % (tools.ustr(e)))
+ _logger.error('Exception: %s\n' % (tools.ustr(e)))
return False
def get_document_revision_search(portType, sessionid, module_id=None):
from osv import osv, fields
from tools.safe_eval import safe_eval
+_logger = logging.getLogger(__name__)
+
class portal_menu(osv.osv):
"""
Fix menu class to customize the login search for menus,
portal_ids = portal_obj.search(cr, uid, [('users', 'in', uid)])
if portal_ids:
if len(portal_ids) > 1:
- log = logging.getLogger('ir.ui.menu')
- log.warning('User %s belongs to several portals', str(uid))
+ _logger.warning('User %s belongs to several portals', str(uid))
p = portal_obj.browse(cr, uid, portal_ids[0])
# if the portal overrides the menu, use its domain
if p.menu_action_id:
from base.res.res_users import _lang_get
-
+_logger = logging.getLogger(__name__)
# welcome email sent to new portal users (note that calling tools.translate._
# has no effect except exporting those strings for translation)
body = _(WELCOME_EMAIL_BODY) % data
res = mail_message_obj.schedule_with_attach(cr, uid, email_from , [email_to], subject, body, context=context)
if not res:
- logging.getLogger('res.portal.wizard').warning(
+ _logger.warning(
'Failed to send email from %s to %s', email_from, email_to)
return {'type': 'ir.actions.act_window_close'}
#
##############################################################################
+import logging
+
from osv import osv, fields
from tools.translate import _
+_logger = logging.getLogger(__name__)
+
UID_ROOT = 1
SHARED_DOCS_MENU = "Documents"
SHARED_DOCS_CHILD_MENU = "Shared Documents"
# v6.1, the algorithm for combining them will OR the rules, hence
# extending the visible data.
Rules.write(cr, UID_ROOT, share_rule_ids, {'groups': [(4,target_group.id)]})
- self._logger.debug("Linked sharing rules from temporary sharing group to group %s", target_group)
+ _logger.debug("Linked sharing rules from temporary sharing group to group %s", target_group)
# Copy the access rights. This is appropriate too because
# groups have the UNION of all permissions granted by their
# access right lines.
for access_line in share_group.model_access:
Rights.copy(cr, UID_ROOT, access_line.id, default={'group_id': target_group.id})
- self._logger.debug("Copied access rights from temporary sharing group to group %s", target_group)
+ _logger.debug("Copied access rights from temporary sharing group to group %s", target_group)
# finally, delete it after removing its users
Groups.write(cr, UID_ROOT, [share_group_id], {'users': [(6,0,[])]})
Groups.unlink(cr, UID_ROOT, [share_group_id])
- self._logger.debug("Deleted temporary sharing group %s", share_group_id)
+ _logger.debug("Deleted temporary sharing group %s", share_group_id)
def _finish_result_lines(self, cr, uid, wizard_data, share_group_id, context=None):
super(share_wizard_portal,self)._finish_result_lines(cr, uid, wizard_data, share_group_id, context=context)
from tools.safe_eval import safe_eval
import openerp
+_logger = logging.getLogger(__name__)
+
FULL_ACCESS = ('perm_read', 'perm_write', 'perm_create', 'perm_unlink')
READ_WRITE_ACCESS = ('perm_read', 'perm_write')
READ_ONLY_ACCESS = ('perm_read',)
return ''.join(random.sample(RANDOM_PASS_CHARACTERS,10))
class share_wizard(osv.osv_memory):
- _logger = logging.getLogger('share.wizard')
_name = 'share.wizard'
_description = 'Share Wizard'
except Exception:
# Note: must catch all exceptions, as UnquoteEvalContext may cause many
# different exceptions, as it shadows builtins.
- self._logger.debug("Failed to cleanup action context as it does not parse server-side", exc_info=True)
+ _logger.debug("Failed to cleanup action context as it does not parse server-side", exc_info=True)
result = context_str
return result
[x.id for x in current_user.groups_id], target_model_ids, context=context)
group_access_map = self._get_access_map_for_groups_and_models(cr, uid,
[group_id], target_model_ids, context=context)
- self._logger.debug("Current user access matrix: %r", current_user_access_map)
- self._logger.debug("New group current access matrix: %r", group_access_map)
+ _logger.debug("Current user access matrix: %r", current_user_access_map)
+ _logger.debug("New group current access matrix: %r", group_access_map)
# Create required rights if allowed by current user rights and not
# already granted
need_creation = True
if need_creation:
model_access_obj.create(cr, UID_ROOT, values)
- self._logger.debug("Creating access right for model %s with values: %r", model.model, values)
+ _logger.debug("Creating access right for model %s with values: %r", model.model, values)
def _link_or_copy_current_user_rules(self, cr, current_user, group_id, fields_relations, context=None):
rule_obj = self.pool.get('ir.rule')
'groups': [(6,0,[group_id])],
'domain_force': rule.domain, # evaluated version!
})
- self._logger.debug("Copying rule %s (%s) on model %s with domain: %s", rule.name, rule.id, model.model, rule.domain_force)
+ _logger.debug("Copying rule %s (%s) on model %s with domain: %s", rule.name, rule.id, model.model, rule.domain_force)
else:
# otherwise we can simply link the rule to keep it dynamic
rule_obj.write(cr, 1, [rule.id], {
'groups': [(4,group_id)]
})
- self._logger.debug("Linking rule %s (%s) on model %s with domain: %s", rule.name, rule.id, model.model, rule.domain_force)
+ _logger.debug("Linking rule %s (%s) on model %s with domain: %s", rule.name, rule.id, model.model, rule.domain_force)
def _check_personal_rule_or_duplicate(self, cr, group_id, rule, context=None):
"""Verifies that the given rule only belongs to the given group_id, otherwise
'groups': [(6,0,[group_id])],
'domain_force': rule.domain_force, # non evaluated!
})
- self._logger.debug("Duplicating rule %s (%s) (domain: %s) for modified access ", rule.name, rule.id, rule.domain_force)
+ _logger.debug("Duplicating rule %s (%s) (domain: %s) for modified access ", rule.name, rule.id, rule.domain_force)
# then disconnect from group_id:
rule.write({'groups':[(3,group_id)]}) # disconnects, does not delete!
return rule_obj.browse(cr, UID_ROOT, new_id, context=context)
if restrict:
continue
else:
- self._logger.debug("Ignoring sharing rule on model %s with domain: %s the same rule exists already", model_id, domain)
+ _logger.debug("Ignoring sharing rule on model %s with domain: %s the same rule exists already", model_id, domain)
return
if restrict:
# restricting existing rules is done by adding the clause
new_clause = expression.normalize(eval(domain, eval_ctx))
combined_domain = expression.AND([new_clause, org_domain])
rule.write({'domain_force': combined_domain, 'name': rule.name + _('(Modified)')})
- self._logger.debug("Combining sharing rule %s on model %s with domain: %s", rule.id, model_id, domain)
+ _logger.debug("Combining sharing rule %s on model %s with domain: %s", rule.id, model_id, domain)
if not restrict:
# Adding the new rule in the group is ok for normal cases, because rules
# in the same group and for the same model will be combined with OR
'domain_force': domain,
'groups': [(4,group_id)]
})
- self._logger.debug("Created sharing rule on model %s with domain: %s", model_id, domain)
+ _logger.debug("Created sharing rule on model %s with domain: %s", model_id, domain)
def _create_indirect_sharing_rules(self, cr, current_user, wizard_data, group_id, fields_relations, context=None):
rule_name = _('Indirect sharing filter created by user %s (%s) for group %s') % \
group_id, model_id=model.id, domain=str(related_domain),
rule_name=rule_name, restrict=True, context=context)
except Exception:
- self._logger.exception('Failed to create share access')
+ _logger.exception('Failed to create share access')
raise osv.except_osv(_('Sharing access could not be created'),
_('Sorry, the current screen and filter you are trying to share are not supported at the moment.\nYou may want to try a simpler filter.'))
}
def send_emails(self, cr, uid, wizard_data, context=None):
- self._logger.info('Sending share notifications by email...')
+ _logger.info('Sending share notifications by email...')
mail_message = self.pool.get('mail.message')
user = self.pool.get('res.users').browse(cr, UID_ROOT, uid)
context=context))
# force direct delivery, as users expect instant notification
mail_message.send(cr, uid, msg_ids, context=context)
- self._logger.info('%d share notification(s) sent.', len(msg_ids))
+ _logger.info('%d share notification(s) sent.', len(msg_ids))
def onchange_embed_options(self, cr, uid, ids, opt_title, opt_search, context=None):
wizard = self.browse(cr, uid, ids[0], context)
import logging
import decimal_precision as dp
-_logger = logging.getLogger('mps')
-
+_logger = logging.getLogger(__name__)
def rounding(fl, round_value):
if not round_value:
from osv import fields, osv
from openerp import SUPERUSER_ID
+_logger = logging.getLogger(__name__)
+
class CompanyLDAP(osv.osv):
_name = 'res.company.ldap'
_order = 'sequence'
except ldap.INVALID_CREDENTIALS:
return False
except ldap.LDAPError, e:
- logger = logging.getLogger('orm.ldap')
- logger.error('An LDAP exception occurred: %s', e)
+ _logger.error('An LDAP exception occurred: %s', e)
return entry
def query(self, conf, filter, retrieve_attributes=None):
"""
results = []
- logger = logging.getLogger('orm.ldap')
try:
conn = self.connect(conf)
conn.simple_bind_s(conf['ldap_binddn'] or '',
filter, retrieve_attributes, timeout=60)
conn.unbind()
except ldap.INVALID_CREDENTIALS:
- logger.error('LDAP bind failed.')
+ _logger.error('LDAP bind failed.')
except ldap.LDAPError, e:
- logger.error('An LDAP exception occurred: %s', e)
+ _logger.error('An LDAP exception occurred: %s', e)
return results
def map_ldap_attributes(self, cr, uid, conf, login, ldap_entry):
if res[1]:
user_id = res[0]
elif conf['create_user']:
- logger = logging.getLogger('orm.ldap')
- logger.debug("Creating new OpenERP user \"%s\" from LDAP" % login)
+ _logger.debug("Creating new OpenERP user \"%s\" from LDAP" % login)
user_obj = self.pool.get('res.users')
values = self.map_ldap_attributes(cr, uid, conf, login, ldap_entry)
if conf['user']: