Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storing online users in sqlalchemy database #23

Open
daniel2013 opened this issue Oct 22, 2013 · 1 comment
Open

Storing online users in sqlalchemy database #23

daniel2013 opened this issue Oct 22, 2013 · 1 comment

Comments

@daniel2013
Copy link

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
Copy link
Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant