Merge lp:~mhall119/loco-team-portal/fixes-589226 into lp:loco-team-portal

Proposed by Michael Hall
Status: Merged
Merged at revision: 145
Proposed branch: lp:~mhall119/loco-team-portal/fixes-589226
Merge into: lp:loco-team-portal
Diff against target: 12 lines (+1/-1)
1 file modified
loco_directory/events/views.py (+1/-1)
To merge this branch: bzr merge lp:~mhall119/loco-team-portal/fixes-589226
Reviewer Review Type Date Requested Status
Dave Walker Approve
Review via email: mp+26722@code.launchpad.net

Description of the change

AnonymousUser doesn't have group associations, so calling request.user.groups, when the user is not logged in, throws this error. I added a check that request.user.is_authenticated() before doing that, to short-circuit the if condition before it tries that.

To post a comment you must log in.
Revision history for this message
Dave Walker (davewalker) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'loco_directory/events/views.py'
2--- loco_directory/events/views.py 2010-05-31 13:07:10 +0000
3+++ loco_directory/events/views.py 2010-06-03 16:42:26 +0000
4@@ -298,7 +298,7 @@
5 detailed view for a global event
6 """
7 global_event_object = get_object_or_404(GlobalEvent, pk=global_event_id)
8- add_team_event = (request.user and \
9+ add_team_event = (request.user and request.user.is_authenticated() and \
10 request.user.groups.exclude(name__exact='ubuntu-lococouncil'))
11 context = {
12 'global_event_object': global_event_object,

Subscribers

People subscribed via source and target branches