Django

Code

Ticket #4751 (closed: fixed)

Opened 1 year ago

Last modified 1 year ago

anonymous user cannot be converted to string

Reported by: canburak@cs.bilgi.edu.tr Assigned to: jacob
Milestone: Component: Uncategorized
Version: SVN Keywords:
Cc: Triage Stage: Accepted
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description (Last modified by mtredinnick)

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)

Attachments

Change History

07/03/07 07:15:22 changed by mtredinnick

  • needs_better_patch changed.
  • stage changed from Unreviewed to Accepted.
  • description changed.
  • needs_tests changed.
  • needs_docs changed.

(Fixed description formatting.)

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

07/03/07 07:24:47 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(In [5590]) Fixed #4751 -- Fixed that AnonymousUser?.str to always return a string object, as required by Python.


Add/Change #4751 (anonymous user cannot be converted to string)




Change Properties
Action