Skip to content

Commit

Permalink
Merge pull request #42 from gh640/fix_no_attribute_MIDDLEWARE_CLASSES…
Browse files Browse the repository at this point in the history
…_error

Issue #41: Fix MIDDLEWARE_CLASSES error with `runserver`
  • Loading branch information
HassenPy committed May 4, 2018
2 parents a192e51 + 360bffb commit 8f57b2c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
0.6.2 - Compat for middleware check
0.6.1 - Python 3 compatibility fix
0.6.0 - Version 0.6 (Django 1.10 support)
0.4.0 - Py3k support
Expand Down
2 changes: 1 addition & 1 deletion django_pdb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import print_function
from django.conf import settings
__version__ = '0.6.1'
__version__ = '0.6.2'

POST_MORTEM = getattr(settings, 'POST_MORTEM', False)
DEBUG = getattr(settings, 'DEBUG', False)
Expand Down
9 changes: 6 additions & 3 deletions django_pdb/management/commands/runserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,13 @@ def handle(self, *args, **options):
pdb_option = options.pop('pdb')
ipdb_option = options.pop('ipdb')

middleware = 'django_pdb.middleware.PdbMiddleware'
pdb_middleware = 'django_pdb.middleware.PdbMiddleware'
middleware = (settings.MIDDLEWARE
if hasattr(settings, 'MIDDLEWARE')
else settings.MIDDLEWARE_CLASSES)
if ((pdb_option or settings.DEBUG)
and middleware not in settings.MIDDLEWARE_CLASSES):
settings.MIDDLEWARE_CLASSES += (middleware,)
and pdb_middleware not in middleware):
middleware += (pdb_middleware,)

self.pm = options.pop('pm')
if self.pm:
Expand Down

0 comments on commit 8f57b2c

Please sign in to comment.