diff --git a/openedx/core/djangoapps/content/course_overviews/management/commands/generate_course_overview.py b/openedx/core/djangoapps/content/course_overviews/management/commands/generate_course_overview.py index def0fcdfe7..6fffc27694 100644 --- a/openedx/core/djangoapps/content/course_overviews/management/commands/generate_course_overview.py +++ b/openedx/core/djangoapps/content/course_overviews/management/commands/generate_course_overview.py @@ -24,12 +24,17 @@ class Command(BaseCommand): args = '' help = 'Generates and stores course overview for one or more courses.' - option_list = BaseCommand.option_list + ( - make_option('--all', - action='store_true', - default=False, - help='Generate course overview for all courses.'), - ) + def add_arguments(self, parser): + """ + Add arguments to the command parser. + """ + parser.add_argument( + '--all', + action='store_true', + dest='all', + default=False, + help='Generate course overview for all courses.', + ) def handle(self, *args, **options): diff --git a/openedx/core/djangoapps/course_groups/management/commands/post_cohort_membership_fix.py b/openedx/core/djangoapps/course_groups/management/commands/post_cohort_membership_fix.py index 22886a8a40..29afef6a78 100644 --- a/openedx/core/djangoapps/course_groups/management/commands/post_cohort_membership_fix.py +++ b/openedx/core/djangoapps/course_groups/management/commands/post_cohort_membership_fix.py @@ -15,16 +15,29 @@ class Command(BaseCommand): help = ''' Repairs any potential inconsistencies made in the window between running migrations 0005 and 0006, and deploying the code changes to enforce use of CohortMembership that go with said migrations. - |commit|: optional argument. If not provided, will dry-run and list number of operations that would be made. + + commit: optional argument. If not provided, will dry-run and list number of operations that would be made. ''' + def add_arguments(self, parser): + """ + Add arguments to the command parser. + """ + parser.add_argument( + '--commit', + action='store_true', + dest='commit', + default=False, + help='Really commit the changes, otherwise, just dry run', + ) + def handle(self, *args, **options): """ Execute the command. Since this is designed to fix any issues cause by running pre-CohortMembership code with the database already migrated to post-CohortMembership state, we will use the pre-CohortMembership table CourseUserGroup as the canonical source of truth. This way, changes made in the window are persisted. """ - commit = 'commit' in options + commit = options['commit'] memberships_to_delete = 0 memberships_to_add = 0