Commits

Anonymous committed 4d4ea56

make handler process models that have a "read", "update", or "create"a attribute

  • Participants
  • Parent commits 92644a4

Comments (0)

Files changed (1)

piston/emitters.py

 from __future__ import generators
 
 import decimal, re, inspect
+import copy
 
 try:
     # yaml isn't standard with python.  It shouldn't be required if it
                                     
                 else:
                     get_fields = set(fields)
+                
+                get_fields_copy = copy.deepcopy(get_fields)
 
-                met_fields = self.method_fields(handler, get_fields)
+                for reserved_field in ['read','update','delete','create']:
+                    get_fields_copy.discard(reserved_field)
 
+                met_fields = self.method_fields(handler, get_fields_copy)
+                
                 for f in data._meta.local_fields:
                     if f.serialize and not any([ p in met_fields for p in [ f.attname, f.name ]]):
                         if not f.rel:
                 
                 # try to get the remainder of fields
                 for maybe_field in get_fields:
-                    
+                    print maybe_field, type(maybe_field)
                     if isinstance(maybe_field, (list, tuple)):
                         model, fields = maybe_field
                         inst = getattr(data, model, None)