Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-548

convert mongodb query (unicode) to json using json_util

    • Type: Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.5.2
    • Component/s: None
    • Environment:

      help request on
      http://stackoverflow.com/questions/17997744/convert-mongodb-query-unicode-to-json-using-json-util too

      this error raise randomly
      /core/handlers/wsgi.py", line 38, in _call_,
      output = lookup_view(req),
      File "auth/decorator.py", line 8, in wrap,
      return fn(req,args,*kwargs),
      File "auth/decorator.py", line 21, in wrap,
      return fn(req,args,*kwargs),
      File "contrib/admin/views.py", line 67, in submit_base_premission,
      return json_response({"baseperm":baseperm,"Meta":{"gmsg":u"...","type":201}}),
      File "render/render_response.py", line 85, in json_response,
      return {"response":dumps(response,ensure_ascii=False).encode("utf8"),
      File "/usr/local/lib/python2.7/dist-packages/bson/json_util.py", line 116, in dumps,
      return json.dumps(_json_convert(obj), *args, **kwargs),
      File "/usr/lib/python2.7/json/_init_.py", line 238, in dumps, referer:
      **kw).encode(obj),
      File "/usr/lib/python2.7/json/encoder.py", line 201, in encode,
      chunks = self.iterencode(o, _one_shot=True),
      File "/usr/lib/python2.7/json/encoder.py", line 264, in iterencode,
      return _iterencode(o, 0),
      File "/usr/lib/python2.7/json/encoder.py", line 178, in default,
      raise TypeError(repr(o) + " is not JSON serializable"),
      TypeError: ObjectId('51f7dcee95113b7a48e974fe') is not JSON serializable,

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            h.rastegar Hosein rastegar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: