diff --git a/gen/mixins/ToolMixin.py b/gen/mixins/ToolMixin.py index 3999346..21bcfb8 100644 --- a/gen/mixins/ToolMixin.py +++ b/gen/mixins/ToolMixin.py @@ -1136,13 +1136,22 @@ class ToolMixin(BaseMixin): def manageError(self, error): '''Manages an error.''' tb = sys.exc_info() - from zExceptions.ExceptionFormatter import format_exception - htmlMessage = format_exception(tb[0], tb[1], tb[2], as_html=1) - textMessage = format_exception(tb[0], tb[1], tb[2], as_html=0) - self.log(''.join(textMessage).strip(), type='error') - return '
| An error occurred. %s' \ - ' |
' \
+ 'You are not allowed to access this page.' % \
+ (siteUrl, siteUrl)
+ userId = self.appy().user.getId() or 'system|anon'
+ textMessage = 'Unauthorized for %s @%s.' % \
+ (userId, self.REQUEST.get('PATH_INFO'))
+ else:
+ from zExceptions.ExceptionFormatter import format_exception
+ htmlMessage = format_exception(tb[0], tb[1], tb[2], as_html=1)
+ htmlMessage = '\n'.join(htmlMessage)
+ textMessage = format_exception(tb[0], tb[1], tb[2], as_html=0)
+ textMessage = ''.join(textMessage).strip()
+ self.log(textMessage, type='error')
+ return '