Commits

Mads Sülau Valstorp Jørgensen  committed 0764bde

Proper indention.

  • Participants
  • Parent commits b4c6fbc

Comments (0)

Files changed (2)

File piston/handler.py

     def update(self, request, *args, **kwargs):
         if not self.has_model():
             raise NotImplementedError
-            
+        
         inst = self.queryset.get(*args, **kwargs)
         print "must update instance", inst, "with", request.PUT
         
             raise NotImplementedError
         
         return "I can't do this yet."
+

File piston/resource.py

     """
     callmap = { 'GET': 'read', 'POST': 'create', 
                 'PUT': 'update', 'DELETE': 'delete' }
-
+    
     def __init__(self, handler, authentication=None):
         if not callable(handler):
             raise AttributeError, "Handler not callable."
-
+        
         self.handler = handler()
-
+        
         if not authentication:
             self.authentication = NoAuthentication()
         else:
             self.authentication = authentication
-        
+    
     def __call__(self, request, *args, **kwargs):
-
         if not self.authentication.is_authenticated(request):
             return self.authentication.challenge()
-
+        
         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 rm == "PUT":
+            coerce_put_post(request)
+        
         if not rm in self.handler.allowed_methods:
             return HttpResponseNotAllowed(self.handler.allowed_methods)
-
+        
         meth = getattr(self.handler, Resource.callmap.get(rm), None)
-
-        if not meth:        
+        
+        if not meth:
             raise Http404
-
+        
         try:
             result = meth(request, *args, **kwargs)
         except FormValidationError, errors:
         srl = emitter(result, typemapper)
         
         return HttpResponse(srl.render(), mimetype=ct)
+