1. Luke Plant
  2. django-piston


Benjamin Pollack  committed 8db39c8

we're already using inspect; remove use of types and isinstance

  • Participants
  • Parent commits 612b3e6
  • Branches default

Comments (0)

Files changed (1)

File piston/emitters.py

View file
 from __future__ import generators
-import types, decimal, types, re, inspect
+import decimal, re, inspect
     # yaml isn't standard with python.  It shouldn't be required if it
                 ret = _model(thing, fields=fields)
             elif isinstance(thing, HttpResponse):
                 raise HttpStatusCode(thing.content, code=thing.status_code)
-            elif isinstance(thing, types.FunctionType):
+            elif inspect.isfunction(thing):
                 if not inspect.getargspec(thing)[0]:
                     ret = _any(thing())
             elif hasattr(thing, '__emittable__'):