Skip to content
Snippets Groups Projects
Commit 467eb70f authored by amitvadhel's avatar amitvadhel
Browse files

INCR-141: Run python-modernize on...

INCR-141: Run python-modernize on openedx/core/djangoapps/content/block_structure [migrations, management, config]
parent 3ac77658
No related merge requests found
Showing with 19 additions and 8 deletions
......@@ -2,6 +2,8 @@
This module contains various configuration settings via
waffle switches for the Block Structure framework.
"""
from __future__ import absolute_import
from openedx.core.djangoapps.waffle_utils import WaffleSwitchNamespace
from openedx.core.lib.cache_utils import request_cached
......
"""
Models for configuration of Block Structures.
"""
from __future__ import absolute_import
from django.db.models import IntegerField
from config_models.models import ConfigurationModel
......
"""
Command to load course blocks.
"""
from __future__ import absolute_import
import logging
from django.core.management.base import BaseCommand
import six
from six import text_type
from xmodule.modulestore.django import modulestore
......@@ -136,7 +139,7 @@ class Command(BaseCommand):
except Exception as ex: # pylint: disable=broad-except
log.exception(
u'BlockStructure: An error occurred while generating course blocks for %s: %s',
unicode(course_key),
six.text_type(course_key),
text_type(ex),
)
......@@ -148,7 +151,7 @@ class Command(BaseCommand):
action = tasks.update_course_in_cache_v2 if options.get('force_update') else tasks.get_course_in_cache_v2
task_options = {'routing_key': options['routing_key']} if options.get('routing_key') else {}
result = action.apply_async(
kwargs=dict(course_id=unicode(course_key), with_storage=options.get('with_storage')),
kwargs=dict(course_id=six.text_type(course_key), with_storage=options.get('with_storage')),
**task_options
)
log.info(u'BlockStructure: ENQUEUED generating for course: %s, task_id: %s.', course_key, result.id)
......
"""
Tests for generate_course_blocks management command.
"""
from __future__ import absolute_import
import ddt
from django.core.management.base import CommandError
import itertools
import six
from six.moves import range
from mock import patch
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
......@@ -82,13 +86,13 @@ class TestGenerateCourseBlocks(ModuleStoreTestCase):
def test_one_course(self):
self._assert_courses_not_in_block_cache(*self.course_keys)
self.command.handle(courses=[unicode(self.course_keys[0])])
self.command.handle(courses=[six.text_type(self.course_keys[0])])
self._assert_courses_in_block_cache(self.course_keys[0])
self._assert_courses_not_in_block_cache(*self.course_keys[1:])
self._assert_courses_not_in_block_storage(*self.course_keys)
def test_with_storage(self):
self.command.handle(with_storage=True, courses=[unicode(self.course_keys[0])])
self.command.handle(with_storage=True, courses=[six.text_type(self.course_keys[0])])
self._assert_courses_in_block_cache(self.course_keys[0])
self._assert_courses_in_block_storage(self.course_keys[0])
self._assert_courses_not_in_block_storage(*self.course_keys[1:])
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
from django.db import migrations, models
import django.db.models.deletion
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
from django.db import migrations, models
import django.utils.timezone
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
from django.db import migrations, models
import openedx.core.djangoapps.content.block_structure.models
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from __future__ import absolute_import, unicode_literals
from django.db import migrations, models
import openedx.core.djangoapps.xmodule_django.models
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment