I think the session is StackedObjectProxy.

session._current_obj() will get you the actual instance that you can then pass on to your thread.

I am really not sure on the thread-safety of this, may be someone else can chime in.

DD.

sniipe wrote:
Any idea?

On Jan 22, 1:21 pm, sniipe<[email protected]>  wrote:
Hi!

Is it possible to use session in created thread in my action, like:

...
from pylons import session
import thread
...

class UsersController(BaseController):
     def _check_user(self, user):
         # do something with session object
         ...

     def some_action(self, user):
         ...
         thread.start_new_thread(self._check_user, (user,))
         ...

When I try to do it this way I received exception:

TypeError: No object (name: session) has been registered for this
thread

Do I need to register session in thread? How? :)

I will create thread because I don't want to wait for some code to
finish job.

Thanks in advance for your help :)


--
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