Opened 17 years ago

Last modified 17 years ago

#4751 closed

anonymous user cannot be converted to string — at Version 1

Reported by: canburak@… Owned by: Jacob
Component: Uncategorized Version: dev
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Malcolm Tredinnick)

the code:

class SomeMiddleware:
    def process_request(self, req):
        print type(req.user)
        print type(req.user.__str__())
        print req.user.__str__().__class__
        print req.user
        return None

prints out

<class 'django.contrib.auth.models.AnonymousUser'>
<type 'instance'>
django.utils.functional.__proxy__
Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 272, in run
    self.result = application(self.environ, self.start_response)
  File "/usr/lib/python2.5/site-packages/django/core/servers/basehttp.py", line 614, in __call__
    return self.application(environ, start_response)
  File "/usr/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 189, in __call__
    response = self.get_response(request)
  File "/usr/lib/python2.5/site-packages/django/core/handlers/base.py", line 59, in get_response
    response = middleware_method(request)
  File "/home/can/vc/darcs/baklava/baklava/../baklava/reiloy/middlewares.py", line 13, in process_request
    print req.user
TypeError: __str__ returned non-string (type instance)

Change History (1)

comment:1 by Malcolm Tredinnick, 17 years ago

Description: modified (diff)
Triage Stage: UnreviewedAccepted

(Fixed description formatting.)

I thought we'd fixed this. Apparently I am confused, though, and it is only fixed on the Unicode branch.

Note: See TracTickets for help on using tickets.
Back to Top