Hi All, I'm sure I'm missing something obvious here, but I'm relatively new to Python programming and to Django, so I'd appreciate any help that you all have to offer.
I'm writing a function that takes in a username and password via a SOAP method (this all works well), authenticates the user, logs them in, and then returns to them the session id (i.e. the pk of the Session model) so they can use it in subsequent requests. Here's what I've noticed: def loginAndGetSession(username, password): user = authenticate(username=username, password=password) if user is not None: sid = soap.request.session.session_key login(soap.request, user) s = Session.objects.get(pk=soap.request.session.session_key) return s.session_key else: return 'BADAUTH' Note the statement that sets "sid" equal to the session_key stored in the request; if I remove that, the call to get the Session object by its pk fails with a "Session matching query does not exist" error. With the statement, everything evaluates correctly. If I try to do: s = Session.objects.get(pk=sid) that also fails. It seems like I need to reference the session_key variable before I can use it. Can anybody explain why? Thanks a bunch, Dan --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---