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

[BUG] Treebeard 4.5 leads to major issue #6980

Closed
jbpenrath opened this issue Feb 18, 2021 · 10 comments · Fixed by #6988
Closed

[BUG] Treebeard 4.5 leads to major issue #6980

jbpenrath opened this issue Feb 18, 2021 · 10 comments · Fixed by #6988

Comments

@jbpenrath
Copy link

jbpenrath commented Feb 18, 2021

Description

Release of django-treebeard 4.5 seems introduce breacking change from django-cms.

IntegrityError at /en/admin/cms/page/add-plugin/

duplicate key value violates unique constraint "cms_cmsplugin_path_4917bb44_uniq"
DETAIL:  Key (path)=() already exists.

Steps to reproduce

Steps to reproduce the behavior:

  1. Install a fresh django-cms or update your dependencies to have treebeard 4.5 installed
  2. Create a page with no content
  3. Publish it
  4. Edit it then add a plugin
  5. Save our plugin content
  6. Then boom !

Expected behaviour

I should be able to add a plugin without error.

Actual behaviour

An error occured when I try to save a plugin.

Screenshots

Capture d’écran 2021-02-18 à 12 05 53

Additional information (CMS/Python/Django versions)

Python: 3.6.11
Django-CMS: 3.8.0

I reproduced this error on a fresh install from Divio.

Quick workaround : Rollback to treebeard 4.4

We identify the following change as potential source of this issue. django-treebeard/django-treebeard#192

@srinathganesh
Copy link

srinathganesh commented Feb 20, 2021

  • We have the exact same error in a new deployment.
  • Change of version mentioned by you worked, except now am getting this error during publish of a page.
    err: ValueError: invalid literal for int() with base 36: ''

@VeshRaazThapa
Copy link

VeshRaazThapa commented Feb 23, 2021

mine worked by rolling back to django-treebeard==4.3.1
django==3.1.7
django-cms==3.8.0

@philfuster
Copy link

I am also experiencing this. This is after the install of 4.5.1.
image

@yml
Copy link
Contributor

yml commented Feb 25, 2021

It is interesting to note that wagtail was also impacted by the recent changes wagtail/wagtail#6820.
It looks like this ticket ( django-treebeard/django-treebeard#211) assumes that the version 4.5.1 resolving this issue which is not what I observe (\cc @philfuster ).

Edit: Just find out this ticket (django-treebeard/django-treebeard#210) that explains the details of why it is still broken

@DonkeyOatie
Copy link

DonkeyOatie commented Feb 25, 2021

I am seeing something I believe is related and is stopping us from publishing pages

  File "/opt/venv/lib/python3.6/site-packages/cms/utils/plugins.py", line 213, in copy_plugins_to_placeholder
    new_plugin = CMSPlugin.add_root(instance=new_plugin)
  File "/opt/venv/lib/python3.6/site-packages/treebeard/mp_tree.py", line 617, in add_root
    This method saves the node in database. The object is populated as if via:
  File "/opt/venv/lib/python3.6/site-packages/treebeard/mp_tree.py", line 326, in process
    # adding the new root node as the last one
treebeard.exceptions.NodeAlreadySaved: Attempted to add a tree node that is already in the database

I have tried rolling back to treebeard 4.3.1 and 4.4.0 (running fix-tree at each stage) and nothing seems to resolve the issue.

Django CMS: 3.8.0
Django 2.2.19
Python 3.6

@philfuster
Copy link

@DonkeyOatie I was working with a fresh install so I created the project over. By uninstalling treebeard and installing the 4.3.1 version of treebeard as @VeshRaazThapa said, I got it to work.
NOTE: Uninstall and install correct version of treebeard before first runserver or makemigrations/migrate command.

@DonkeyOatie
Copy link

DonkeyOatie commented Feb 25, 2021

@philfuster thanks for the suggestion. That is pretty hard to do for us as we are running inside a docker container on a managed platform. I will see if I can script this to happen before the app starts. Thanks for the info.

UPDATE: downgrading pre-run seems to have worked. Phil, I owe you several beers!

@philfuster
Copy link

Glad I could help @DonkeyOatie ! How about instead of beers, could I trouble you for some time in the future to discuss what your experiences with djangocms are? This is my first time using it for a marketing site I am building and there are some things I don't understand how I would implement.

@DonkeyOatie
Copy link

Anytime @philfuster my email is on my profile

@andychoi
Copy link

I tried to modify as below with try except.

    def str2int(self, num):
        """Converts a string into an integer.

        radix, alphabet = self.radix, self.alphabet
        if radix <= 36 and alphabet[:radix].lower() == BASE85[:radix].lower():
            try: return int(num, radix)
            except: return 0

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

Successfully merging a pull request may close this issue.

7 participants