]> git.ozlabs.org Git - patchwork/commitdiff
views/user: don't refer to request.POST for non-POST requests
authorJeremy Kerr <jk@ozlabs.org>
Wed, 11 Aug 2010 08:28:25 +0000 (16:28 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Wed, 11 Aug 2010 08:28:25 +0000 (16:28 +0800)
We're ending up wth form errors due to using request.POST, which is
empty.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
apps/patchwork/views/user.py

index f9ff7f89a32d011b1d79eee8a9d4ac6c51dc53e8..8358cbd2d752c349c443fa17c938853e8b9819ce 100644 (file)
@@ -63,7 +63,6 @@ def profile(request):
 def link(request):
     context = PatchworkRequestContext(request)
 
-    form = UserPersonLinkForm(request.POST)
     if request.method == 'POST':
         form = UserPersonLinkForm(request.POST)
         if form.is_valid():
@@ -82,6 +81,8 @@ def link(request):
                 context['confirmation'] = None
                 context['error'] = 'An error occurred during confirmation. ' + \
                                    'Please try again later'
+    else:
+        form = UserPersonLinkForm()
     context['linkform'] = form
 
     return render_to_response('patchwork/user-link.html', context)