Commits

Matthew Marshall committed 9cf7ef7

Fixed a problem with using authentication with the django test client on PUT requests.

Comments (0)

Files changed (1)

piston/resource.py

         """
         rm = request.method.upper()
 
+        # Django's internal mechanism doesn't pick up
+        # PUT request, so we trick it a little here.
+        if rm == "PUT":
+            coerce_put_post(request)
+
         if not self.authentication.is_authenticated(request):
             if hasattr(self.handler, 'anonymous') and \
                 callable(self.handler.anonymous) and \
         else:
             handler = self.handler
             anonymous = handler.is_anonymous
-                
-        # Django's internal mechanism doesn't pick up
-        # PUT request, so we trick it a little here.
-        if rm == "PUT":
-            coerce_put_post(request)
         
         # Translate nested datastructs into `request.data` here.
         translate_mime(request)