summaryrefslogtreecommitdiff
path: root/packages/views.py
diff options
context:
space:
mode:
authorDusty Phillips <buchuki@gmail.com>2009-05-04 20:24:41 -0400
committerDusty Phillips <buchuki@gmail.com>2009-05-04 20:24:41 -0400
commita025708ef9f4f32daab29ca96b3fbec49a7b05dd (patch)
tree3e4dffa98936e4d23bcd6754885997384e9274af /packages/views.py
parentbb93f05f56f2b22a662f85736549a72735864b20 (diff)
Fix a bug when someone accesses the update page without POSTINg adopt or disown. Probably occurred by a press of the back button.
Diffstat (limited to 'packages/views.py')
-rw-r--r--packages/views.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/packages/views.py b/packages/views.py
index 49ab9a0a..835323fc 100644
--- a/packages/views.py
+++ b/packages/views.py
@@ -15,6 +15,7 @@ from archweb_dev.main.utils import make_choice
def update(request):
ids = request.POST.getlist('pkgid')
+ mode = None
if request.POST.has_key('adopt'):
mode = 'adopt'
maint_id = request.user.id
@@ -22,13 +23,16 @@ def update(request):
mode = 'disown'
maint_id = 0
- for id in ids:
- pkg = Package.objects.get(id=id)
- pkg.maintainer_id = maint_id
- pkg.save()
+ if mode:
+ for id in ids:
+ pkg = Package.objects.get(id=id)
+ pkg.maintainer_id = maint_id
+ pkg.save()
- request.user.message_set.create(message="%d packages %sed" % (
- len(ids), mode))
+ request.user.message_set.create(message="%d packages %sed" % (
+ len(ids), mode))
+ else:
+ request.user.message_set.create(message="update called without adopt/disown")
return HttpResponseRedirect('/packages/')
def details(request, name='', repo='', arch=''):