Skip to content

fix: Handle cms command raising error #8054

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

Merged
merged 2 commits into from
Nov 5, 2024

Conversation

mrbazzan
Copy link
Contributor

@mrbazzan mrbazzan commented Nov 1, 2024

When "python manage.py cms" is run on the CLI;
it should not raise AttributeError, rather it
should be caught and a nice error message should be printed

Fixes #8045

Description

Related resources

  • #...
  • #...

Checklist

  • I have opened this pull request against develop-4
  • I have added or modified the tests when changing logic
  • I have followed the conventional commits guidelines to add meaningful information into the changelog
  • I have read the contribution guidelines and I have joined the channel #pr-reviews on our Discord Server to find a “pr review buddy” who is going to review my pull request.

@mrbazzan
Copy link
Contributor Author

mrbazzan commented Nov 1, 2024

I also think this could be alternatively solved by removing the create_parser method in
cms.management.commands.subcommands.base.SubcommandsCommand and
setting the suppressed_base_arguments class variable.
Right now, the method almost does the same as django's BaseCommand.create_parser

@fsbraun
Copy link
Member

fsbraun commented Nov 1, 2024

@mrbazzan Thanks for the pull request! Can you add a test to cms.tests.test_management.py to ensure that ./manage cms returns the appropriate error message to the user?

You might have a look here for ideas: test_migrations.

When "python manage.py cms" is run on the CLI;
it should not raise AttributeError, rather it
should be caught and a nice error message should be printed

Fixes django-cms#8045
Copy link
Member

@fsbraun fsbraun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Thanks!

@fsbraun fsbraun merged commit 69962fe into django-cms:develop-4 Nov 5, 2024
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] cms command should not raise AttributeError
2 participants