Anonymous avatar Anonymous committed 2ade799 Draft Merge

Merge default -> py27.

Comments (0)

Files changed (1)

codereview/views.py

         # Try the previous hour's token
         xsrf_token = account.get_xsrf_token(-1)
         if post_token != xsrf_token:
-          return HttpTextResponse('Invalid XSRF token.', status=403)
+          msg = [u'Invalid XSRF token.']
+          if request.POST:
+            msg.extend([u'',
+                        u'However, this was the data posted to the server:',
+                        u''])
+            for key in request.POST:
+              msg.append(u'%s: %s' % (key, request.POST[key]))
+            msg.extend([u'', u'-'*10,
+                        u'Please reload the previous page and post again.'])
+          return HttpTextResponse(u'\n'.join(msg), status=403)
     return func(request, *args, **kwds)
 
   return xsrf_wrapper
   """/<issue>/content/<patchset>/<patch>/<content> - Return patch's content."""
   response = HttpResponse(request.content.data, content_type=request.mime_type)
   filename = re.sub(
-      r'[^\w\.]', '_', response.patch.filename.encode('ascii', 'replace'))
+      r'[^\w\.]', '_', request.patch.filename.encode('ascii', 'replace'))
   response['Content-Disposition'] = 'attachment; filename="%s"' % filename
   response['Cache-Control'] = 'no-cache, no-store'
   return response
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.