From 8e029e99b8a5f48edf0fd003ac2ddd321d446fe8 Mon Sep 17 00:00:00 2001 From: Dusty Phillips Date: Sun, 29 Jun 2008 20:44:02 -0400 Subject: drop an unnecessary db hit --- packages/views.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'packages') diff --git a/packages/views.py b/packages/views.py index e9162c0f..0fa781c4 100644 --- a/packages/views.py +++ b/packages/views.py @@ -18,9 +18,10 @@ def update(request): if request.POST.has_key('disown'): mode = 'disown' message = 'Disown was successful' - try: - maint = User.objects.get(username=request.user.username) - except User.DoesNotExist: + + if request.user.is_authenticated(): + maint = request.user + else: return render_response(request, 'error_page.html', {'errmsg':'No maintainer record found! Are you a maintainer?'}) ids = request.POST.getlist('pkgid') for id in ids: -- cgit v1.2.3-54-g00ecf