fafhrd91 / pyramid_sockjs

44 stars 13 forks source link

Storing online users in sqlalchemy database #23

Open daniel2013 opened 10 years ago

daniel2013 commented 10 years ago

Hi,

How can I store online users in my database with the chat example? I can access the current user object but can't persist changes to it.

Using transaction.commit() after changing user.is_online to True results in a DetachedInstanceError.

Thanks,

Daniel

daniel2013 commented 10 years ago

I have solved the problem by calling "user = DBSession.merge(self.request.globals['user'])" at the start of every on_ function. I can then use user.is_online=True and transaction.commit(). Is this a good solution?