Hi -

My specific pylons setup is is a probably a bit extraordinary, but I'm
running into a problem that I can only imagine others have encountered
(but I haven't been able to google an answer).

Basically, I have an application that has an AMF controller (amf.py)
and then a more traditional controller (default.py) with actions like
"download_file" which wouldn't be appropriate to send as AMF
responses.  The methods in my default.py controller require
authentication, which is created by an authenticate() service method
that is served up via AMF (amf.py) but sets a username in
pylons.session.  Basically the frontend is all Flex but we have some
occasional need for non-Flex requests -- and, of course, everything
needs to require (and share) authentication.

What I would like to do is be able to write functional tests for the
default.py controller.  Since these require authentication, I would
like to establish a valid session by calling my authenticate()
service.  I can't figure out how to get calls to my service method to
"share" the same session object (which is wrapped up in a
StackedObjectProxy).  Here's a snippet of what I was attempting:

# This is all supposed to be within a method in my TestController
subclass.

# 1) Use a ProxyRemotingService to route service requests to my
configured wsgi app
wsgiapp = self.app.app  # The wsgi app is wrapped within a TestApp
client = ProxyRemotingService("http://example.com/amf";, proxy=wsgiapp)
service = self.client.getService('myservice')
service.authenticate('user', 'pass')

#2) Now attempt to perform a request using the TestApp
response = self.app.get(url=''/protected-url', headers={})

The first call works fine -- the authenticate() method sets the
session.  But the session isn't the same as the one that gets
referenced by self.app.get(...) call, so I get an "unauth"
exception.

I'm sure I'm just doing something silly here or missing the obvious
right way to do this.  I feel that I'm trapped in StackedObjectProxy
hell! :)

Thanks in advance -
Hans

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to