[gen] Adapted all logged messages because thhe logged user is now automatically prepended to any message.
This commit is contained in:
parent
ac1d710288
commit
7889277328
5 changed files with 21 additions and 19 deletions
|
@ -675,7 +675,7 @@ class ToolMixin(BaseMixin):
|
|||
align = self.flipLanguageDirection(align, dir)
|
||||
field = self.getAppyType(fieldName, className)
|
||||
if not field:
|
||||
self.log('Field "%s", used in a column specifier, was not ' \
|
||||
self.log('field "%s", used in a column specifier, was not ' \
|
||||
'found.' % fieldName, type='warning')
|
||||
else:
|
||||
res.append(Object(field=field, width=width, align=align))
|
||||
|
@ -1093,14 +1093,14 @@ class ToolMixin(BaseMixin):
|
|||
msg = self.translate('enable_cookies')
|
||||
return self.goto(urlBack, msg)
|
||||
# Authenticate the user.
|
||||
login = rq.get('__ac_name', None)
|
||||
if self.getUser(authentify=True) or \
|
||||
self.getUser(authentify=True, source='ldap'):
|
||||
msg = self.translate('login_ok')
|
||||
logMsg = 'User "%s" logged in.' % login
|
||||
logMsg = 'logged in.'
|
||||
else:
|
||||
msg = self.translate('login_ko')
|
||||
logMsg = 'Authentication failed with login "%s".' % login
|
||||
login = rq.get('__ac_name') or '<empty>'
|
||||
logMsg = 'authentication failed with login %s.' % login
|
||||
self.log(logMsg)
|
||||
return self.goto(self.getApp().absolute_url(), msg)
|
||||
|
||||
|
@ -1120,7 +1120,7 @@ class ToolMixin(BaseMixin):
|
|||
session = sdm.getSessionData(create=0)
|
||||
if session is not None:
|
||||
session.invalidate()
|
||||
self.log('User "%s" has been logged out.' % userId)
|
||||
self.log('logged out.')
|
||||
# Remove user from variable "loggedUsers"
|
||||
if self.loggedUsers.has_key(userId): del self.loggedUsers[userId]
|
||||
return self.goto(self.getApp().absolute_url())
|
||||
|
@ -1268,7 +1268,7 @@ class ToolMixin(BaseMixin):
|
|||
htmlMessage = '<a href="/">Back</a> You are not allowed to ' \
|
||||
'access this page.'
|
||||
userId = self.appy().user.login
|
||||
textMessage = 'Unauthorized for %s @%s.' % \
|
||||
textMessage = 'unauthorized for %s @%s.' % \
|
||||
(userId, self.REQUEST.get('PATH_INFO'))
|
||||
else:
|
||||
from zExceptions.ExceptionFormatter import format_exception
|
||||
|
|
|
@ -178,8 +178,8 @@ class BaseMixin:
|
|||
history.append(event)
|
||||
self.workflow_history[key] = tuple(history)
|
||||
appy = self.appy()
|
||||
self.log('Data change event deleted by %s for %s (UID=%s).' % \
|
||||
(appy.user.login, appy.klass.__name__, appy.uid))
|
||||
self.log('data change event deleted for %s (UID=%s).' % \
|
||||
(appy.klass.__name__, appy.uid))
|
||||
self.goto(self.getUrl(rq['HTTP_REFERER']))
|
||||
|
||||
def onLink(self):
|
||||
|
@ -563,7 +563,11 @@ class BaseMixin:
|
|||
if type == 'warning': logMethod = logger.warn
|
||||
elif type == 'error': logMethod = logger.error
|
||||
else: logMethod = logger.info
|
||||
logMethod('%s: %s' % (self.getTool().getUser().login, msg))
|
||||
user = self.getTool().getUser()
|
||||
# There could be not user at all (even not "anon") if we are trying to
|
||||
# authenticate an inexistent user for example.
|
||||
login = user and user.login or 'anon'
|
||||
logMethod('%s: %s' % (login, msg))
|
||||
|
||||
def do(self):
|
||||
'''Performs some action from the user interface.'''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue