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

Flushing the session should expire the instance and it's children #33

Closed
fayazkhan opened this issue Oct 10, 2014 · 4 comments
Closed
Assignees
Labels
Milestone

Comments

@fayazkhan
Copy link

This test currently fails.

    def test_session_expire(self):
        node = self.session.query(self.model).filter(self.model.ppk == 4).one()
        node.move_after('1')
        self.session.flush()
        # self.session.expire(node)
        self.assertEqual(node.tree_id, 2)
        self.assertEqual(node.parent_id, None)

Expiring the node solves the problem. So shouldn't the after_flush_post_exec listener be expiring those attributes too?
A simpler solution would be to update those values from mptt_before_update.

@uralbash
Copy link
Owner

Thank you for your issue, it,s very similar to #30
I'll add a check tree_id in after_flush_post_exec

@uralbash uralbash self-assigned this Oct 10, 2014
@uralbash uralbash added the bug label Oct 10, 2014
@uralbash uralbash added this to the mptt v0.1.0 milestone Oct 10, 2014
uralbash added a commit that referenced this issue Oct 10, 2014
@fayazkhan
Copy link
Author

Shouldn't all the children also be expired there?
Something similar to what you're doing for the parents?

uralbash added a commit that referenced this issue Oct 10, 2014
@uralbash
Copy link
Owner

All the children expired with parent after flush. See example 62779c9

@uralbash uralbash reopened this Oct 11, 2014
uralbash added a commit that referenced this issue Oct 11, 2014
@uralbash
Copy link
Owner

I created a new branch path-33 for this issue, until I can not pass this test https://github.com/ITCase/sqlalchemy_mptt/blob/path-33/sqlalchemy_mptt/tests/tree_testing_base.py#L1732

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

2 participants