From 432a40f0357a9362a4a7f22e5e179f86cc7a6451 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Mon, 8 Feb 2016 19:47:39 -0500 Subject: [PATCH 1/2] Update post_cohort_management_fix to Django 1.8 --- .../commands/post_cohort_membership_fix.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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 From d8b9dec51e3d01fb662ed1bc779d06fe9f723cb5 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Tue, 9 Feb 2016 07:06:12 -0500 Subject: [PATCH 2/2] Update this command for Django 1.8 --- .../commands/generate_course_overview.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) 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):