Hey guys,
thanks for the help. I actually got it working like this:
class AliasMiddleware(object):
def process_request(self, request):
assert hasattr(request, 'session'), "The Django authentication
middleware requires session middleware to be installed. Edit your
MIDDLEWARE_CLASSES setting to insert
'django.contrib.sessions.middleware.SessionMiddleware'."
if request.POST:
if 'username' in request.POST:
request.session['alias'] = request.POST['username']
return None
This quote below from the django documentation helped me. I needed to
add it into session because I needed it to be visible across
processes.
"Don’t override request.session with a new object, and don’t access or
set its attributes. Use it like a Python dictionary."
If I am remembering correctly I think I was able to modify the request
class as follows:
request.__class__.fun = request.POST['username']
But my variable fun was not accessible across processes. So it's
working and I think I understand why now, but if you see any obvious
mistakes feel free to let me know!
Thanks!
BTW..Alex Ezell..I have taken note of your comment about using if
request.method == "POST": instead of if request.POST: but I think in
my case here it doesn't matter because I am not checking for the
method. In this case, I only care about POST and whether it contains
any values. If I am wrong here please let me know. Thanks for
answering my post. This is a great resource and I am grateful to all
who post answers too help out.
csmith
csmith
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---