On Nov 3, 10:23 am, "Jakub Labath" <[EMAIL PROTECTED]> wrote: > Hi All, > > I have serious problem with my django websites. > I've experienced random user switching.
I experienced this on my site. I figured it was some sort of weird race condition since it only happened every once in a while. I worked around it by storing the current ip of the user into the session in the login view. Then I made some custom middleware with a process_view function, which if a user is logged in, checked the ip from the session with the request's ip. If not, i'd log the user out. Since it only happened every once in a while, users weren't bothered. Then, I discovered that it did bother some users of certain ISP's (AOL), where the IP changed quite often. So, I disabled this custom middleware. The problem reappeared. I then put back the middleware, but made both branches passthrough. The problem hasn't reappeared ever since. Just doing that must disable the race condition. It's weird. I don't know. What I use now: class testmw(object): def process_view(self, request, view_func, view_args, view_kwargs): if view_func != huzzah.forum.views.login: if request.session.get('LOGGED_IN_IP','')[:5] != request.META['REMOTE_ADDR'][:5]: return None return None --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---