I found the error,
In my instance at the server I had added a line like,
from django.contrib.auth.views import login, logout
which was conflicting with the import I was expectating,
from django.contrib.auth import authenticate, login

I had added this after deployment to the server.

On Sep 12, 7:06 pm, shabda <[EMAIL PROTECTED]> wrote:
> I am trying to loging a user after they fill a form, using code
>
>     if request.method == 'POST':
>         data = request.POST.copy()
>         errors = form.get_validation_errors(data)
>         if not errors:
>             new_user = form.save(data)
>             user_profile = UserProfile(user = new_user, karma = 1,
> page_links = -1)
>             user_profile.save()
>             user = authenticate(username=request.POST['username'],
> password=request.POST['password1'])
>             login(request, user)
>             return HttpResponseRedirect("/")
>
> I am getting an exception saying 'User' object has no attribute
> 'startswith'
> This same code works on my home machine running pyton 2.4.3, but fails
> on my linux server running python 2.4.4.
>
> Traceback (most recent call last):
> File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py"
> in get_response
>   77. response = callback(request, *callback_args, **callback_kwargs)
> File "/home/shabda/django/redpy/reddit/views.py" in register
>   290. login(request, user)
> File "/usr/lib/python2.4/site-packages/django/contrib/auth/views.py"
> in login
>   32. }, context_instance=RequestContext(request))
> File "/usr/lib/python2.4/site-packages/django/shortcuts/__init__.py"
> in render_to_response
>   10. return HttpResponse(loader.render_to_string(*args, **kwargs))
> File "/usr/lib/python2.4/site-packages/django/template/loader.py" in
> render_to_string
>   101. t = get_template(template_name)
> File "/usr/lib/python2.4/site-packages/django/template/loader.py" in
> get_template
>   79. source, origin = find_template_source(template_name)
> File "/usr/lib/python2.4/site-packages/django/template/loader.py" in
> find_template_source
>   68. source, display_name = loader(name, dirs)
> File "/usr/lib/python2.4/site-packages/django/template/loaders/
> filesystem.py" in load_template_source
>   15. for filepath in get_template_sources(template_name,
> template_dirs):
> File "/usr/lib/python2.4/site-packages/django/template/loaders/
> filesystem.py" in get_template_sources
>   11. yield os.path.join(template_dir, template_name)
> File "/usr/lib/python2.4/posixpath.py" in join
>   60. if b.startswith('/'):
>
>   AttributeError at /register/
>   'User' object has no attribute 'startswith'


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to