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
add first child if there's no last child #235
base: master
Are you sure you want to change the base?
Conversation
@@ -374,7 +375,7 @@ def process(self): | |||
' and UPDATE your database')) | |||
else: | |||
# adding the new child as the last one | |||
newobj.path = self.node.get_last_child()._inc_path() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like what's happening here is the self.numchild
attribute has been updated but the database doesn't have the child there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested in my end, your changes are currently better than mine, but both need more tests for
Thanks, do you have a repeat for this crash it seems to be intermittently happening for me |
it been more than 2 years I'm working on it without any issues till before two days, I'm using it with wagtail-cms, I was getting this error only when I was initializing my first time data using django-shell (based on Python shell), the rest of treebeard nodes are being created by website's editors/authors who use buttons that being controlled by views. |
Any update on merging this? Seems like a relatively straight-forward fix. |
It seems no one maintaining this repo anymore, or they forgot about this PR..! |
@jrief seeing as you were the last contributor to merge into |
I'm happy to review this, but I do think it will need tests to cover the change and illustrate the issue it is fixing. |
As things stand this is fixing a symptom of #220, rather than the bug itself, and causing a performance regression along the way. For background: the By skipping the
in the new version with:
However, there's still an open question about whether silently correcting for inconsistent numchild values is a good thing - for the sake of developer friendliness - or whether we're better off letting them fail loudly so that inconsistencies can be spotted early and fixed with |
fixes #140 and #220