Permalink
Browse files

Fix uninstalling operation tracker

  • Loading branch information...
thomasst committed Jun 20, 2013
1 parent 215ae89 commit eebead4cbd016cec73bc461344ac2ed284940da5
Showing with 10 additions and 20 deletions.
  1. +10 −20 flask_mongoengine/operation_tracker.py
@@ -207,28 +207,18 @@ def privar(name):
return result
def install_tracker():
if pymongo.collection.Collection.insert != _insert:
pymongo.collection.Collection.insert = _insert
if pymongo.collection.Collection.update != _update:
pymongo.collection.Collection.update = _update
if pymongo.collection.Collection.remove != _remove:
pymongo.collection.Collection.remove = _remove
if pymongo.cursor.Cursor._refresh != _cursor_refresh:
pymongo.cursor.Cursor._refresh = _cursor_refresh
if pymongo.helpers._unpack_response != _unpack_response:
pymongo.helpers._unpack_response = _unpack_response
pymongo.collection.Collection.insert = _insert
pymongo.collection.Collection.update = _update
pymongo.collection.Collection.remove = _remove
pymongo.cursor.Cursor._refresh = _cursor_refresh
pymongo.helpers._unpack_response = _unpack_response
def uninstall_tracker():
if pymongo.collection.Collection.insert == _insert:
pymongo.collection.Collection.insert = _original_methods['insert']
if pymongo.collection.Collection.update == _update:
pymongo.collection.Collection.update = _original_methods['update']
if pymongo.collection.Collection.remove == _remove:
pymongo.collection.Collection.remove = _original_methods['remove']
if pymongo.cursor.Cursor._refresh == _cursor_refresh:
pymongo.cursor.Cursor._refresh = _original_methods['cursor_refresh']
if pymongo.helpers._unpack_response == _unpack_response:
pymongo.helpers._unpack_response = _original_methods['_unpack_response']
pymongo.collection.Collection.insert = _original_methods['insert']
pymongo.collection.Collection.update = _original_methods['update']
pymongo.collection.Collection.remove = _original_methods['remove']
pymongo.cursor.Cursor._refresh = _original_methods['refresh']
pymongo.helpers._unpack_response = _original_methods['_unpack_response']
def reset():
global queries, inserts, updates, removes, response_sizes

0 comments on commit eebead4

Please sign in to comment.