Hi,
I'm not using Django's built in auth application.  When I go to a URL that
doesn't exist, I get this error:

  AttributeError: 'WSGIRequest' object has no attribute 'user'

Here's part of the stack trace:

  File "/Library/Python/2.5/site-packages/django/views/defaults.py", line
79, in page_not_found
    return http.HttpResponseNotFound(t.render(RequestContext(request,
{'request_path': request.path})))

  File "/Library/Python/2.5/site-packages/django/template/context.py", line
100, in __init__
    self.update(processor(request))

  File
"/Library/Python/2.5/site-packages/django/core/context_processors.py", line
18, in auth
    'user': request.user,

For some reason context_processors.auth is still being called, which tries
to access auth.user.  But the docstring for the context_processors.auth
suggests that it's only used for applications that use Django's auth:

    """
    Returns context variables required by apps that use Django's
authentication
    system.
    """

Anyways, If I stub out a Middleware class and stick in a fake user, it seems
to work fine.  I also have to define a get_and_delete_messages method
because context_processors.auth calls that on the user object:

    # added this to settings.py
    class FakeMiddleware(object):
        def process_request(self, request):
            request.user = User()

I'll get the 404.html page rendered as expected.  But it seems kind of
strange that I'd have to do this because I'm not using the auth application.
 It's probably something wrong with my settings.py, has anyone else had the
same issue?

Thanks,
- Hugh Bien

--~--~---------~--~----~------------~-------~--~----~
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