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

InvalidRequestError still happens #79

Open
skytreader opened this issue Dec 21, 2017 · 0 comments
Open

InvalidRequestError still happens #79

skytreader opened this issue Dec 21, 2017 · 0 comments
Labels

Comments

@skytreader
Copy link
Owner

Traceback (most recent call last):
  File "/home/chad/kode/alexandria/librarian/api.py", line 314, in edit_book
    form.illustrators.data)
  File "/home/chad/kode/alexandria/librarian/api.py", line 242, in edit_contrib
    db.session.add(contribution)
  File "/home/chad/.virtualenvs/alexandria/local/lib/python2.7/site-packages/sqlalchemy/orm/scoping.py", line 157, in do
    return getattr(self.registry(), name)(*args, **kwargs)
  File "/home/chad/.virtualenvs/alexandria/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 1677, in add
    self._save_or_update_state(state)
  File "/home/chad/.virtualenvs/alexandria/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 1696, in _save_or_update_state
    self._save_or_update_impl(st_)
  File "/home/chad/.virtualenvs/alexandria/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 1995, in _save_or_update_impl
    self._update_impl(state)
  File "/home/chad/.virtualenvs/alexandria/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 1984, in _update_impl
    self.identity_map.add(state)
  File "/home/chad/.virtualenvs/alexandria/local/lib/python2.7/site-packages/sqlalchemy/orm/identity.py", line 134, in add
    orm_util.state_str(state), state.key))
InvalidRequestError: Can't attach instance <Role at 0x7fc7894f4ad0>; another instance with key (<class 'librarian.models.Role'>, (2L,)) is already present in this session.

Try doing this in a unit test: Have two books which will be edited to have an Illustrator modified. Editing the second book should throw this error.

In the meantime, a workaround is restarting the server. :(

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

No branches or pull requests

1 participant