Commit 692502c0 by David Baumgold

Don't cache falsy values

parent 3eee6589
......@@ -404,6 +404,8 @@ class LocMapperStore(object):
"""
Get the course Locator for this old course id
"""
if not old_course_id:
return None
entry = self.cache.get(old_course_id)
if entry is not None:
if published:
......@@ -428,6 +430,8 @@ class LocMapperStore(object):
"""
For quick lookup of courses
"""
if not old_course_id:
return
self.cache.set(old_course_id, (published_course_locator, draft_course_locator))
def _cache_location_map_entry(self, old_course_id, location, published_usage, draft_usage):
......
......@@ -80,8 +80,8 @@ class TestLocationMapper(unittest.TestCase):
Request translation, check package_id, block_id, and branch
"""
prob_locator = loc_mapper().translate_location(
old_style_course_id,
location,
old_style_course_id,
location,
published= (branch=='published'),
add_entry_if_missing=add_entry
)
......@@ -114,7 +114,7 @@ class TestLocationMapper(unittest.TestCase):
new_style_package_id = '{}.geek_dept.{}.baz_run'.format(org, course)
block_map = {
'abc123': {'problem': 'problem2'},
'abc123': {'problem': 'problem2'},
'def456': {'problem': 'problem4'},
'ghi789': {'problem': 'problem7'},
}
......@@ -139,7 +139,7 @@ class TestLocationMapper(unittest.TestCase):
# add a distractor course (note that abc123 has a different translation in this one)
distractor_block_map = {
'abc123': {'problem': 'problem3'},
'abc123': {'problem': 'problem3'},
'def456': {'problem': 'problem4'},
'ghi789': {'problem': 'problem7'},
}
......
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