Changes between Version 88 and Version 89 of BackwardsIncompatibleChanges


Ignore:
Timestamp:
May 5, 2007, 11:13:16 AM (17 years ago)
Author:
Russell Keith-Magee
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BackwardsIncompatibleChanges

    v88 v89  
    2222 * April 20, 2007: [http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#MySQLIntrospectionChange MySQL Introspection change]
    2323 * April 25, 2007: [http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#LOGIN_URLisnowasetting Login URL is now a setting]
     24 * May 5, 2007: [http://code.djangoproject.com/wiki/BackwardsIncompatibleChanges#TestClientloginmethodchanged Test Client `login()` method changed]
    2425
    2526== Database constraint names changed ==
     
    126127
    127128should be changed to refer to `settings.LOGIN_URL` instead.
     129
     130== Test Client `login()` method changed ==
     131
     132The implementation of `django.test.Client.login()` operated as a wrapper around a series of GET and POST calls accessing a nominated login URL. This approach was fragile, and tightly bound to specific templates and login mechanims.
     133
     134In [5152], we changed the implementation of the `login()` method on the test Client. `login()` now accepts a list of credentials, and exercises these credentials directly on the cookies and Session objects of a site, without accessing or using a login page. This breaks the dependence on specific template formatting, and enables the login mechanism to work with any authentication backend, and any login decorator.
     135
     136Existing uses of `login()`, e.g.:
     137{{{
     138c = Client()
     139c.login('/path/to/login','myuser','mypassword')
     140}}}
     141should be modified to read:
     142{{{
     143c = Client()
     144c.login(username='myuser', password='mypassword')
     145}}}
     146The keyword arguments `username` and `password` *must* be given explicitly. If an alternate authentication scheme is in use, the credentials required by that scheme can be provided instead of `username` and `password`.
Back to Top