~cjwatson/loggerhead/revision-ui-quote-from-bytes

« back to all changes in this revision

Viewing changes to loggerhead/util.py

  • Committer: Colin Watson
  • Date: 2020-07-08 17:14:19 UTC
  • mto: This revision was merged to the branch mainline in revision 505.
  • Revision ID: cjwatson@canonical.com-20200708171419-8bfgqcmrany2i91h
Drop dependency on simplejson.

The standard library's json module in Python >= 2.6 will do fine.

Show diffs side-by-side

added added

removed removed

Lines of Context:
670
670
        d = obj.__dict__.copy()
671
671
        del d['_properties']
672
672
        return d
 
673
    elif isinstance(obj, bytes):
 
674
        return obj.decode('UTF-8')
673
675
    elif isinstance(obj, datetime.datetime):
674
676
        return tuple(obj.utctimetuple())
675
677
    raise TypeError(repr(obj) + " is not JSON serializable")