Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| import functools | |
| import pymongo | |
| import logging | |
| import time | |
| MAX_AUTO_RECONNECT_ATTEMPTS = 5 | |
| def graceful_auto_reconnect(mongo_op_func): | |
| """Gracefully handle a reconnection event.""" | |
| @functools.wraps(mongo_op_func) |
| diff --git a/pymongo/connection.py b/pymongo/connection.py | |
| index b444f50..7635c78 100644 | |
| --- a/pymongo/connection.py | |
| +++ b/pymongo/connection.py | |
| @@ -46,6 +46,7 @@ from pymongo import (database, | |
| helpers, | |
| message) | |
| from pymongo.cursor_manager import CursorManager | |
| +from pymongo.decorators import reconnect | |
| from pymongo.errors import (AutoReconnect, |