Commit 8bc7ae14 by noraiz-anwar

delete_course command with course keys containing unicode chars

parent a9d68c32
...@@ -32,7 +32,10 @@ class Command(BaseCommand): ...@@ -32,7 +32,10 @@ class Command(BaseCommand):
help = 'Delete a MongoDB backed course' help = 'Delete a MongoDB backed course'
def add_arguments(self, parser): def add_arguments(self, parser):
parser.add_argument('course_key', help='ID of the course to delete.') parser.add_argument(
'course_key',
help='ID of the course to delete.',
)
parser.add_argument( parser.add_argument(
'--keep-instructors', '--keep-instructors',
...@@ -50,7 +53,9 @@ class Command(BaseCommand): ...@@ -50,7 +53,9 @@ class Command(BaseCommand):
def handle(self, *args, **options): def handle(self, *args, **options):
try: try:
course_key = CourseKey.from_string(options['course_key']) # a course key may have unicode chars in it
course_key = unicode(options['course_key'], 'utf8')
course_key = CourseKey.from_string(course_key)
except InvalidKeyError: except InvalidKeyError:
raise CommandError('Invalid course_key: {}'.format(options['course_key'])) raise CommandError('Invalid course_key: {}'.format(options['course_key']))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment