Skip to content

Commit

Permalink
zope: fixed AttributeError on anonymous user
Browse files Browse the repository at this point in the history
  • Loading branch information
mihneasim committed Aug 28, 2012
1 parent 03cc044 commit 87ec549
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions raven/contrib/zope/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ def emit(self, record):
]['QUERY_STRING']
setattr(record, 'sentry.interfaces.Http', http)
user = request.AUTHENTICATED_USER
is_authenticated=user.has_role('Authenticated')
user_dict = dict(id=user.getId(),
is_authenticated=user.has_role('Authenticated'
), email=user.getProperty('email'))
is_authenticated=is_authenticated,
email=(is_authenticated and
user.getProperty('email') or ''))
setattr(record, 'sentry.interfaces.User', user_dict)
except (AttributeError, KeyError):
logger.warning('Could not extract data from request', exc_info=True)
Expand Down

0 comments on commit 87ec549

Please sign in to comment.