Django

Code

Ticket #7756 (closed: duplicate)

Opened 2 years ago

Last modified 2 years ago

contrib.auth dependency on contrib.admin

Reported by: nail.xx Assigned to:
Milestone: Component: Authentication
Version: SVN Keywords: admin dependency test
Cc: Triage Stage: Unreviewed
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

Commit #7808 introduced contrib.auth dependency on contrib.admin. It appears if you included django.contrib.auth in INSTALLED_APPS and didn't include django.contrib.admin. If you will try to run tests (manage.py test), you will see 2 test errors:

======================================================================
ERROR: Email is sent if a valid email address is provided for password reset
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\Python\django-trunk\django\contrib\auth\tests.py", line 73, in test_email_found
    response = self.client.post('/password_reset/', {'email': 'staffmember@example.com'})
  File "D:\Python\django-trunk\django\test\client.py", line 286, in post
    return self.request(**r)
  File "D:\Python\django-trunk\django\core\handlers\base.py", line 86, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "D:\Python\django-trunk\django\contrib\auth\views.py", line 80, in password_reset
    form.save(email_template_name=email_template_name)
  File "D:\Python\django-trunk\django\contrib\auth\forms.py", line 99, in save
    t = loader.get_template(email_template_name)
  File "D:\Python\django-trunk\django\template\loader.py", line 80, in get_template
    source, origin = find_template_source(template_name)
  File "D:\Python\django-trunk\django\template\loader.py", line 73, in find_template_source
    raise TemplateDoesNotExist, name
TemplateDoesNotExist: registration/password_reset_email.html

======================================================================
ERROR: Error is raised if the provided email address isn't currently registered
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\Python\django-trunk\django\contrib\auth\tests.py", line 65, in test_email_not_found
    response = self.client.get('/password_reset/')
  File "D:\Python\django-trunk\django\test\client.py", line 266, in get
    return self.request(**r)
  File "D:\Python\django-trunk\django\core\handlers\base.py", line 86, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "D:\Python\django-trunk\django\contrib\auth\views.py", line 85, in password_reset
    context_instance=RequestContext(request))
  File "D:\Python\django-trunk\django\shortcuts\__init__.py", line 18, in render_to_response
    return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs)
  File "D:\Python\django-trunk\django\template\loader.py", line 102, in render_to_string
    t = get_template(template_name)
  File "D:\Python\django-trunk\django\template\loader.py", line 80, in get_template
    source, origin = find_template_source(template_name)
  File "D:\Python\django-trunk\django\template\loader.py", line 73, in find_template_source
    raise TemplateDoesNotExist, name
TemplateDoesNotExist: registration/password_reset_form.html

This is because default test templates are in contrib.admin application and the test is in contrib.auth.

If this is expected dependency it should be declared in documentation (http://www.djangoproject.com/documentation/authentication/). Or dependency should be removed by using separate URL set and separate templates for that tests.

Attachments

Change History

07/18/08 19:28:49 changed by Simon Greenhill

  • status changed from new to closed.
  • needs_better_patch changed.
  • resolution set to duplicate.
  • needs_tests changed.
  • needs_docs changed.

duplicate of #7611.


Add/Change #7756 (contrib.auth dependency on contrib.admin)




Change Properties
Action