Commit 3fdc8a77 by Brian Zambrano

Fix "$query" KeyError in with PyMongo 2.2+

This appeared to be happening in the case where there were no PyMongo queries
and an empty dictionary was returned.  Using dict.get fixes this problem, and
is backwards compatible with PyMongo < 2.2.

Fixes #13
parent b7a96405
...@@ -168,7 +168,7 @@ def _cursor_refresh(cursor_self): ...@@ -168,7 +168,7 @@ def _cursor_refresh(cursor_self):
# Normal Query # Normal Query
query_data['skip'] = privar('skip') query_data['skip'] = privar('skip')
query_data['limit'] = privar('limit') query_data['limit'] = privar('limit')
query_data['query'] = query_son['$query'] query_data['query'] = query_son.get('$query')
query_data['ordering'] = _get_ordering(query_son) query_data['ordering'] = _get_ordering(query_son)
queries.append(query_data) queries.append(query_data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment