Commits

Jesper Nøhr committed 15dca70 Merge

Comments (0)

Files changed (1)

piston/resource.py

 
         return em
 
+    def form_validation_response(self, e):
+        """
+        Method to return form validation error information. 
+        You will probably want to override this in your own
+        `Resource` subclass.
+        """
+        resp = rc.BAD_REQUEST
+        resp.write(' '+str(e.form.errors))
+        return resp
+
     @property
     def anonymous(self):
         """
         try:
             result = meth(request, *args, **kwargs)
         except FormValidationError, e:
-            resp = rc.BAD_REQUEST
-            resp.write(' '+str(e.form.errors))
-
-            return resp
+            return self.form_validation_response(e)
         except TypeError, e:
             result = rc.BAD_REQUEST
             hm = HandlerMethod(meth)