Merge lp:~toabctl/loco-team-portal/team-detail_get_object_or_404 into lp:~ltp-devs/loco-team-portal/trunk

Proposed by Thomas Bechtold
Status: Merged
Merged at revision: not available
Proposed branch: lp:~toabctl/loco-team-portal/team-detail_get_object_or_404
Merge into: lp:~ltp-devs/loco-team-portal/trunk
Diff against target: 24 lines (+3/-4)
1 file modified
loco_directory/teams/views.py (+3/-4)
To merge this branch: bzr merge lp:~toabctl/loco-team-portal/team-detail_get_object_or_404
Reviewer Review Type Date Requested Status
Daniel Holbach (community) Approve
Review via email: mp+16097@code.launchpad.net

Commit message

use django shortcut "get_object_or_404" to handle unavailable team (lp:495375)

To post a comment you must log in.
Revision history for this message
Thomas Bechtold (toabctl) wrote :

this fixes lp:495375

Revision history for this message
Daniel Holbach (dholbach) wrote :

Thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'loco_directory/teams/views.py'
2--- loco_directory/teams/views.py 2009-12-10 09:01:37 +0000
3+++ loco_directory/teams/views.py 2009-12-13 14:21:14 +0000
4@@ -4,6 +4,8 @@
5 from django.utils.translation import ugettext as _
6 from django.core import serializers
7
8+from django.shortcuts import get_object_or_404
9+
10 from django import http
11
12 from django.contrib.auth.models import AnonymousUser
13@@ -34,10 +36,7 @@
14 RequestContext(request))
15
16 def team(request, team_slug):
17- try:
18- team_object = Team.objects.get(lp_name=team_slug)
19- except:
20- raise Team.DoesNotExist, "%s" % team_slug
21+ team_object = get_object_or_404(Team, lp_name=team_slug)
22 context = {
23 'pageSection': 'teams',
24 'team': team_object,

Subscribers

People subscribed via source and target branches