Skip to content

Commit

Permalink
Fix for newer versions of Django
Browse files Browse the repository at this point in the history
Fix for bellow error
```  
File "/t/env/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 82, in load_middleware
    mw_instance = middleware(handler)
TypeError: object() takes no parameters
```
  • Loading branch information
prashanthmadi committed Jun 7, 2017
1 parent b2085ba commit c2571dc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pyinstrument/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pyinstrument.profiler import NotMainThreadError
import time
import os
from django.utils.deprecation import MiddlewareMixin

not_main_thread_message = (
"pyinstrument can only be used on the main thread in signal mode. Run your server process in "
Expand All @@ -15,7 +16,7 @@
"https://github.com/joerick/pyinstrument#signal-or-setprofile-mode")


class ProfilerMiddleware(object):
class ProfilerMiddleware(MiddlewareMixin):
def process_request(self, request):
profile_dir = getattr(settings, 'PYINSTRUMENT_PROFILE_DIR', None)
use_signal = getattr(settings, 'PYINSTRUMENT_USE_SIGNAL', True)
Expand Down

0 comments on commit c2571dc

Please sign in to comment.