Commits

Jesper Nøhr committed 2fe6f47

issue handler, test for issue CRUD, 'rc' in utils contains status codes

  • Participants
  • Parent commits c2b087f

Comments (0)

Files changed (2)

piston/handler.py

     def has_model(self):
         return hasattr(self, 'model')
     
+    def value_from_tuple(tu, name):
+        for int_, n in tu:
+            if n == name:
+                return int_
+        return None
+    
     def exists(self, **kwargs):
         if not self.has_model():
             raise NotImplementedError
 from django.http import HttpResponseNotAllowed, HttpResponseForbidden
 from django.core.urlresolvers import reverse
 
+class rc(object):
+    """
+    Status codes.
+    """
+    ALL_OK = 'ok.'
+    DUPLICATE_ENTRY = 'already exists.'
+
 class HttpForbidden(HttpResponseForbidden):
     pass