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] No module named 'cms.utils.compat.warnings' when upgrading to 3.11.7 #7992

Closed
jsabater opened this issue Sep 9, 2024 · 6 comments · May be fixed by nephila/djangocms-page-sitemap#120

Comments

@jsabater
Copy link

jsabater commented Sep 9, 2024

Just upgraded from 3.11.6 to 3.11.7 and this error prevents me from starting my Django application:

ModuleNotFoundError
No module named 'cms.utils.compat.warnings'

The error is happening in cms/utils/permissions.py, in has_page_permission(), at line 196:

from cms.utils.compat.warnings import RemovedInDjangoCMS43Warning
@fsbraun
Copy link
Member

fsbraun commented Sep 9, 2024

@jsabater Thanks for reporting! I'll have a look, but it seems an error introduced by backporting.

@fsbraun
Copy link
Member

fsbraun commented Sep 9, 2024

@jsabater Can you please check the traceback to see where has_page_permission is called?

For the moment, you might want to patch has_page_permission:

from cms.utils import permissions
from cms.utils.page_permissions import has_generic_permission

permissions.has_page_permission = (
    lambda user, page, action, use_cache=True: 
        has_generic_permission(page, user, action, site=None, check_global=False, use_cache=use_cache)
)

(sorry, untested)

If has_page_permissionis called from project code, you also might replace the call by a call to has_generic_permission.

@jsabater
Copy link
Author

Hi, @fsbraun ! The method has_page_permission is called, in my case, from djangocms_page_sitemap/cms_toolbars.py in populate at line 29.

Anyhow, I see that you already proposed a fix, which was merged. Will you be re-releasing 3.11.7 or will you releasing 3.11.8 with the fix?

@fsbraun
Copy link
Member

fsbraun commented Sep 10, 2024

Thank you for the info!

A re-release is technically not possible. So the fix will go into 3.11.8. Have you tried patching?

@jsabater
Copy link
Author

No worries, 3.11.8 is fine by me. I am not in a hurry. I have set django-cms==3.11.6 in the requirements.txt file and that works fine. I'll monitor releases and wait patiently :-)

@fsbraun
Copy link
Member

fsbraun commented Sep 11, 2024

@jsabater 3.11.7 has been retracted and 3.11.8 is coming any minute now

@fsbraun fsbraun closed this as completed Sep 11, 2024
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.

2 participants