Fixing URL bug to allow users to have only one URL rule. #2006

wants to merge 1 commit into


None yet

2 participants

Currently Django 1.6 does not allow developers to specify only one URL within the file. The app_name and namespace attributes don't exist and an exception is thrown if only contains one URL.

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/wsgiref/", line 85, in run
self.result = application(self.environ, self.start_response)
File "/Users/dmyerscough/nagios-api-env/lib/python2.7/site-packages/django/contrib/staticfiles/", line 67, in call
return self.application(environ, start_response)
File "/Users/dmyerscough/nagios-api-env/lib/python2.7/site-packages/django/core/handlers/", line 206, in call
response = self.get_response(request)
File "/Users/dmyerscough/nagios-api-env/lib/python2.7/site-packages/django/core/handlers/", line 148, in get_response
response = debug.technical_404_response(request, e)
File "/Users/dmyerscough/nagios-api-env/lib/python2.7/site-packages/django/views/", line 471, in technical_404_response
and tried[0][0].app_name == tried[0][0].namespace == 'admin')):
AttributeError: 'RegexURLPattern' object has no attribute 'app_name'

Steps to reproduce this:-

1 - Edit the file and include only one URL rule

urlpatterns = patterns('',
url(r'^test/', 'nagios_api.views.comments', name='home'),

2 - Connect to the Django web server and the error above will be reproduced.

@dmyerscough dmyerscough Fixing URL bug to allow users to have only one URL rule. The app_name…
… and namespace attributes dont exist and cause a AttributeError

This pull request removes another feature that was added for a good reason (check git blame) instead of fixing the bug.

The correct solution is getattr(tried[0][0], 'app_name', '') == getattr(tried[0][0], 'namespace', '') == 'admin'.

@aaugustin aaugustin closed this Nov 29, 2013
@victorgama victorgama added a commit to victorgama/django that referenced this pull request May 29, 2014
@victorgama victorgama Fixed #21597 -- Recover from faulty connections.
This implements a way of recovering from faulty MySQL Server connections when an error #2006 is issued from the MySQL Connection Adapter.
It renews the (already broken) MySQL Connection and also resets the faulty cursor by replacing its current instance with a brand new one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment