Hey Jacob, understood. Here's some more details that might help:
class LoginForm(Form):
username = fields.CharField(max_length=40)
password = fields.CharField(max_length=40,
widget=widgets.PasswordInput)
def backend_login(request):
from django.contrib.auth.models import User
from django.contrib.auth import login
if request.method == 'POST':
form = LoginForm(request.POST)
if form.is_valid():
try:
user =
User.objects.get(username=request.POST.get('username', ''))
if user.check_password(request.POST.get('password',
'')):
login(request, user)
messages.success(request, 'You\'re now logged
in!')
return
HttpResponseRedirect(reverse('backend_login'))
except User.DoesNotExist:
messages.error(request, 'Incorrect username / password
combo.')
return HttpResponseRedirect(reverse('backend_login'))
else:
form = LoginForm()
data = {
'form': form,
'title': 'User Login'
}
return render_to_response('backend/base.html', data,
RequestContext(request))
Traceback:
File "C:\Python26\Lib\site-packages\django-trunk\django\core\handlers
\base.py" in get_response
100. response = callback(request,
*callback_args, **callback_kwargs)
File "D:\dev\myproject\apps\backend\views.py" in backend_login
25. login(request, user)
File "C:\Python26\Lib\site-packages\django-trunk\django\contrib\auth
\__init__.py" in login
80. request.session[BACKEND_SESSION_KEY] = user.backend
Exception Type: AttributeError at /backend/login/
Exception Value: 'User' object has no attribute 'backend'
On Sep 23, 12:53 pm, Jacob Kaplan-Moss <[email protected]> wrote:
> Hi --
>
> On Thu, Sep 23, 2010 at 1:38 PM, Yo-Yo Ma <[email protected]> wrote:
> > I think I've found a bug in auth.login.
>
> Thanks for the report.
>
> However, for this to be useful, we're going to need a *lot* more
> information -- a complete traceback, the code you used to trigger the
> error, etc. Quoting from the contribution guide [1]: "Do write
> complete, reproducible, specific bug reports. Include as much
> information as you possibly can, complete with code snippets, test
> cases, etc. This means including a clear, concise description of the
> problem, and a clear set of instructions for replicating the problem.
> A minimal example that illustrates the bug in a nice small test case
> is the best possible bug report."
>
> Remember: this code is used every time anyone logs into any Django
> site. That means across the entire Web this code path gets executed
> roughly seventy gazillion times a day. So if there is a bug in it,
> it's a very specific edge-case. We need to know exactly what that edge
> case is.
>
> Thanks again!
>
> Jacob
>
> [1]http://docs.djangoproject.com/en/dev/internals/contributing/#reportin...
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en.