#27360: Make it easier to track down the offending models for AlreadyRegistered
exceptions
-------------------------------------+-------------------------------------
     Reporter:  Ed Morley            |                    Owner:  Quentin
         Type:                       |  Fulsher
  Cleanup/optimization               |                   Status:  assigned
    Component:  contrib.admin        |                  Version:  1.8
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Ed Morley):

 I've gone back to reproduce the original case in the ticket description,
 using:
 * b3740a2fdb80bf10276128cc51a77a7b107ea606 of
 https://github.com/mozilla/treeherder
 * A `vagrant up` followed by `pip install -U django-rest-swagger==2.0.5`
 * a `./manage.py runserver` and making a GET request to `/browserid/csrf/`

 I'm not sure if this appeared in the logs previously, but higher up in
 them I now see:
 `ImportError: No module named urls`

 ...from the `include('rest_framework_swagger.urls')` in:
 
https://github.com/mozilla/treeherder/blob/b3740a2fdb80bf10276128cc51a77a7b107ea606/treeherder/config/urls.py#L19

 Commenting out that line prevents the `AlreadyRegistered` exception
 (django-rest-swagger 2.x changed the method of registering URLs).
 I'm guessing this was some bad interaction between import order and
 django_browserid's copy_registry():
 https://github.com/mozilla/django-
 browserid/blob/v2.0.1/django_browserid/admin.py#L38-L39

 If I try the proposed PR (ie using `model._meta.label`) under this
 testcase, I get:
 `AttributeError: 'Options' object has no attribute 'label'`

 So I'm not 100% sure how best to improve the error message in this
 presumably rather rare edge-case, so perhaps not worth fixing this.
 (Though in the more common case discussed by others above, an improved
 error message may still be helpful?)

--
Ticket URL: <https://code.djangoproject.com/ticket/27360#comment:6>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.9932e40682bd696f3a3c7eaa03aa25bd%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to