Commit e18507f1 by David Baumgold

fix pep8/pylint issues

parent 692502c0
......@@ -11,7 +11,7 @@ from xmodule.modulestore import InvalidLocationError
from xmodule.modulestore.django import loc_mapper
def user_from_str(s):
def user_from_str(identifier):
"""
Return a user identified by the given string. The string could be an email
address, or a stringified integer corresponding to the ID of the user in
......@@ -19,14 +19,16 @@ def user_from_str(s):
will be raised.
"""
try:
user_id = int(s)
user_id = int(identifier)
except ValueError:
return User.objects.get(email=s)
return User.objects.get(email=identifier)
else:
return User.objects.get(id=user_id)
class Command(BaseCommand):
"Migrate a course from old-Mongo to split-Mongo"
help = "Migrate a course from old-Mongo to split-Mongo"
args = "location email <locator>"
......
......@@ -11,9 +11,13 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.persistent_factories import PersistentCourseFactory
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.exceptions import ItemNotFoundError
# pylint: disable=E1101
class TestArgParsing(unittest.TestCase):
"""
Tests for parsing arguments for the `delete_split_course` management command
"""
def setUp(self):
self.command = Command()
......
......@@ -12,9 +12,13 @@ from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.django import loc_mapper
# pylint: disable=E1101
class TestArgParsing(unittest.TestCase):
"""
Tests for parsing arguments for the `migrate_to_split` management command
"""
def setUp(self):
self.command = Command()
......
......@@ -225,9 +225,9 @@ class ModuleStoreTestCase(TestCase):
if contentstore().fs_files:
db = contentstore().fs_files.database
db.connection.drop_database(db)
lm = loc_mapper()
if lm.db:
lm.location_map.drop()
location_mapper = loc_mapper()
if location_mapper.db:
location_mapper.location_map.drop()
@classmethod
def setUpClass(cls):
......
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