Commit 75ad81be by Calen Pennington

Merge pull request #3813 from cpennington/ok-mongoengine-fields

Make mongoengine field for UsageKeys expect a Location
parents bef8134e 4c2e612a
...@@ -59,9 +59,9 @@ class UsageKeyField(mongoengine.StringField): ...@@ -59,9 +59,9 @@ class UsageKeyField(mongoengine.StringField):
""" """
For now saves the usage key in the deprecated location i4x/c4x form For now saves the usage key in the deprecated location i4x/c4x form
""" """
assert isinstance(location, (NoneType, SlashSeparatedCourseKey)) assert isinstance(location, (NoneType, Location))
if location is None: if location is None:
return location return None
return super(UsageKeyField, self).to_mongo(location.to_deprecated_string()) return super(UsageKeyField, self).to_mongo(location.to_deprecated_string())
def to_python(self, location): def to_python(self, location):
......
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