How can I access self.request in an iframe-htmlfile connection (IE8/9)? self.request is always None from an IE8/9 request.
single-file app: http://paste.ofcode.org/XzSpU5uT7bNsmZk3WJMdS9
with your chat.pt as the template file
well, i dont have access to IE, but i tested iframe-htmlfile transport in firefox. works as expected
Meaning, it's expected not to have access to self.request within the class EchoSession(Session)? Because no one else has been able to access self.request with iframe-htmlfile either.
it is expected to have access to request. you should be able to get request object for any transport.
i cant test IE at the moment, i will try to get win box with IE in a week or two.
Even in Chrome and Firefox, with iframe-htmlfile, self.request is None. This is confirmed by other users as well. Because an iframe request is an independent request, perhaps it needs to be retrieved from elsewhere?
what OS do you use? what versions of chrome and firefox?
Windows 7 x64
Ubuntu 11.04 x64
and do you test on master?
ok, i'll install ubuntu today and will try to reproduce
I realize my single-file-app seems to have some issue since it isn't able to use websockets. But the issue exists in my main app and your example app as well (both of which can use websockets without an issue). This happens on both OS's (Windows + Ubuntu) and each browser I listed, where I use iframe-htmlfile as the transport means.
Knock knock =)
chat example used sockjs-0.3.1 and it didnt work. chat example now uses sockjs 0.3.2
Firefox 16.0.1 + Ubuntu 12.04.1 works with sockjs 0.3.2
try again with latest change.
Tried it with sockjs 0.3.2, but the same problem exists. If any iframe transport is used, self.request is None. If you pdb.set_trace() within on_open(self) and check self.request, you can see that it is in fact None.
here is what i get
-> self.manager.broadcast("Someone joined.")
<Request at 0xa8cdacc GET http://localhost:8080/__sockjs__/846/ai03l59f/htmlfile?c=_jp.atenqmo>
I created a fresh virtual environment and I now get the same output. Not sure what the issue was earlier. Continuing on this train though, authenticated_userid(self.request), as well as for sess in self.manager.active_sessions(): print sess both give this error:
for sess in self.manager.active_sessions(): print sess
2012-10-16 13:20:06,387 ERROR [pyramid_sockjs][Dummy-3] Exceptin in .on_open method.
Traceback (most recent call last):
File "/home/raj/cleanenv/lib/python2.7/site-packages/pyramid_sockjs/session.py", line 90, in open
File "/home/raj/Practice/git/newsite/newsite/views/chat.py", line 179, in on_open
nick = authenticated_userid(self.request)
File "/home/raj/cleanenv/lib/python2.7/site-packages/pyramid_sockjs/session.py", line 55, in __str__
result = ['id=%r' % self.id]
TypeError: not all arguments converted during string formatting
<RequestWithUserAttribute at 0x4c15a90 GET http://babasociety.local:6543/__sockjs__/585/89_w5di1/websocket>
Guest3796 should be the authenticated_userid(self.request).
thats bug, fixed in master