From 327cc04f404314d4c05368a6a424ab591a69882d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Andr=C3=A9s=20Rocha?= Date: Mon, 22 Dec 2014 15:46:12 -0500 Subject: [PATCH] Fix email_opt_in_list export command to parse options correctly. --- .../user_api/management/commands/email_opt_in_list.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/openedx/core/djangoapps/user_api/management/commands/email_opt_in_list.py b/openedx/core/djangoapps/user_api/management/commands/email_opt_in_list.py index a97cc88294..61c2d3e483 100644 --- a/openedx/core/djangoapps/user_api/management/commands/email_opt_in_list.py +++ b/openedx/core/djangoapps/user_api/management/commands/email_opt_in_list.py @@ -25,6 +25,7 @@ import time import datetime import contextlib import logging +import optparse from django.core.management.base import BaseCommand, CommandError from django.conf import settings @@ -42,6 +43,9 @@ class Command(BaseCommand): args = " --courses=COURSE_ID_LIST" help = "Generate a list of email opt-in values for user enrollments." + option_list = BaseCommand.option_list + ( + optparse.make_option('--courses ', action='store'), + ) # Fields output in the CSV OUTPUT_FIELD_NAMES = [ @@ -81,6 +85,7 @@ class Command(BaseCommand): # filter out anything not in that list. courses = self._get_courses_for_org(org_list) only_courses = options.get("courses") + if only_courses is not None: only_courses = [ CourseKey.from_string(course_key.strip()) @@ -136,6 +141,7 @@ class Command(BaseCommand): file_path = args[0] org_list = args[1:] + if os.path.exists(file_path): raise CommandError("File already exists at '{path}'".format(path=file_path))