INCR-336 python3 compatibility
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
Script for removing all redundant Mac OS metadata files (with filename ".DS_Store"
|
||||
or with filename which starts with "._") for all courses
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import logging
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
from __future__ import print_function
|
||||
from six import text_type
|
||||
"""
|
||||
Management Command to delete course.
|
||||
"""
|
||||
from __future__ import absolute_import, print_function
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from six import text_type
|
||||
|
||||
from contentstore.utils import delete_course
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
from .prompt import query_yes_no
|
||||
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ At present, it differs from Studio exports in several ways:
|
||||
* It only supports the export of courses. It does not export libraries.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
"""
|
||||
Script for importing courseware from XML format
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from openedx.core.djangoapps.django_comment_common.utils import are_permissions_roles_seeded, seed_permissions_roles
|
||||
from xmodule.contentstore.django import contentstore
|
||||
from xmodule.modulestore import ModuleStoreEnum
|
||||
from xmodule.modulestore.django import modulestore
|
||||
from xmodule.util.sandboxing import DEFAULT_PYTHON_LIB_FILENAME
|
||||
from xmodule.modulestore.xml_importer import import_course_from_xml
|
||||
from xmodule.util.sandboxing import DEFAULT_PYTHON_LIB_FILENAME
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
@@ -2,19 +2,24 @@
|
||||
Command to migrate transcripts to django storage.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
import logging
|
||||
|
||||
from django.core.management import BaseCommand, CommandError
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys.edx.locator import CourseLocator
|
||||
from six.moves import map
|
||||
|
||||
from cms.djangoapps.contentstore.tasks import (
|
||||
DEFAULT_ALL_COURSES,
|
||||
DEFAULT_FORCE_UPDATE,
|
||||
DEFAULT_COMMIT,
|
||||
DEFAULT_FORCE_UPDATE,
|
||||
enqueue_async_migrate_transcripts_tasks
|
||||
)
|
||||
from openedx.core.djangoapps.video_config.models import MigrationEnqueuedCourse, TranscriptMigrationSetting
|
||||
from openedx.core.lib.command_utils import get_mutually_exclusive_required_option, parse_course_keys
|
||||
from openedx.core.djangoapps.video_config.models import TranscriptMigrationSetting, MigrationEnqueuedCourse
|
||||
from xmodule.modulestore.django import modulestore
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@@ -91,7 +96,7 @@ class Command(BaseCommand):
|
||||
if courses_mode == 'all_courses':
|
||||
course_keys = [course.id for course in modulestore().get_course_summaries()]
|
||||
elif courses_mode == 'course_ids':
|
||||
course_keys = map(self._parse_course_key, options['course_ids'])
|
||||
course_keys = list(map(self._parse_course_key, options['course_ids']))
|
||||
else:
|
||||
migration_settings = self._latest_settings()
|
||||
if migration_settings.all_courses:
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
"""
|
||||
Takes user input.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import sys
|
||||
|
||||
from six.moves import input
|
||||
|
||||
|
||||
def query_yes_no(question, default="yes"):
|
||||
"""Ask a yes/no question via raw_input() and return their answer.
|
||||
@@ -29,7 +36,7 @@ def query_yes_no(question, default="yes"):
|
||||
|
||||
while True:
|
||||
sys.stdout.write(question + prompt)
|
||||
choice = raw_input().lower()
|
||||
choice = input().lower()
|
||||
if default is not None and choice == '':
|
||||
return valid[default]
|
||||
elif choice in valid:
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
""" Management command to update courses' search index """
|
||||
from __future__ import absolute_import
|
||||
|
||||
import logging
|
||||
from textwrap import dedent
|
||||
|
||||
@@ -8,6 +10,7 @@ from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from opaque_keys.edx.locator import CourseLocator
|
||||
from search.search_engine_base import SearchEngine
|
||||
from six.moves import map
|
||||
|
||||
from contentstore.courseware_index import CoursewareSearchIndexer
|
||||
from xmodule.modulestore.django import modulestore
|
||||
@@ -101,7 +104,7 @@ class Command(BaseCommand):
|
||||
return
|
||||
else:
|
||||
# in case course keys are provided as arguments
|
||||
course_keys = map(self._parse_course_key, course_ids)
|
||||
course_keys = list(map(self._parse_course_key, course_ids))
|
||||
|
||||
for course_key in course_keys:
|
||||
CoursewareSearchIndexer.do_course_reindex(store, course_key)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"""
|
||||
Common methods for cms commands to use
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
"""
|
||||
Command to scrape thumbnails and add them to the course-videos.
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
|
||||
import logging
|
||||
from six import text_type
|
||||
|
||||
import edxval.api as edxval_api
|
||||
from django.core.management import BaseCommand
|
||||
from django.core.management.base import CommandError
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from six import text_type
|
||||
|
||||
from openedx.core.djangoapps.video_config.models import VideoThumbnailSetting
|
||||
from cms.djangoapps.contentstore.tasks import enqueue_update_thumbnail_tasks
|
||||
from openedx.core.djangoapps.video_config.models import VideoThumbnailSetting
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
"""
|
||||
Verify the structure of courseware as to it's suitability for import
|
||||
"""
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import, print_function
|
||||
|
||||
from argparse import REMAINDER
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
Reference in New Issue
Block a user