From 64d84dd4bac2db37c54a87b6f159523c0df647b3 Mon Sep 17 00:00:00 2001 From: Alban DEFLANDRE Date: Tue, 17 Mar 2015 19:00:53 +0100 Subject: [PATCH] Fix import errors to support Python >3 --- debug_toolbar_mongo/operation_tracker.py | 8 +++++++- debug_toolbar_mongo/panel.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/debug_toolbar_mongo/operation_tracker.py b/debug_toolbar_mongo/operation_tracker.py index 607dfa6..93afcaa 100644 --- a/debug_toolbar_mongo/operation_tracker.py +++ b/debug_toolbar_mongo/operation_tracker.py @@ -2,11 +2,17 @@ import time import inspect import os -import SocketServer +try: + # Python 2 + import SocketServer +except ImportError: + # Python 3 + import socketserver import django from django.conf import settings + import pymongo import pymongo.collection import pymongo.cursor diff --git a/debug_toolbar_mongo/panel.py b/debug_toolbar_mongo/panel.py index 5522621..c947c7c 100644 --- a/debug_toolbar_mongo/panel.py +++ b/debug_toolbar_mongo/panel.py @@ -4,7 +4,7 @@ from debug_toolbar.panels import DebugPanel -import operation_tracker +from debug_toolbar_mongo import operation_tracker _NAV_SUBTITLE_TPL = u''' {% for o, n, t in operations %}