Wednesday, June 23, 2010

authenticate problem with multiple db ?

Hi,
when authenticate is called i get this error http://dpaste.com/210674/
though the user exist in database... is authenticate known to not work
with multiple database context ?

my register function was working fine before that...
i've tried with @transaction.autocommit in place of
@transaction.commit_on_success
to ensure the creation of the user before authenticate is called.

here is the function :
@transaction.autocommit
def register(request,template_name='accounts/
register.html',template_name_success='accounts/
register_success.html'):
if request.method == 'POST':
form = RegisterForm(request.POST)
if form.is_valid():
formdata = form.cleaned_data
user = User.objects.create_user( formdata['username_reg'],

formdata['email_address'],

formdata['password_reg'], )
UserProfile(user=user).save()

user = authenticate( username = formdata['username_reg'],
password = formdata['password_reg'] )
login(request, user)
return render_to_response( template_name_success,
{ },
context_instance =
RequestContext(request) )
else:
form = RegisterForm()
return render_to_response( template_name,
{ 'form': form },
context_instance =
RequestContext(request) )

thanx!

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment