From 192222f2cc6adb05be54494249110d76608a9dfc Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 9 Oct 2013 08:18:38 -0400 Subject: [PATCH] Use a better metadata_cache_key The old code created keys like "('course', 'org')", and the space character caused a warning from Django during tests. Also, strings are probably better than tuples for keys. --- common/lib/xmodule/xmodule/modulestore/mongo/base.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/modulestore/mongo/base.py b/common/lib/xmodule/xmodule/modulestore/mongo/base.py index aec84d1f4c..72835127a6 100644 --- a/common/lib/xmodule/xmodule/modulestore/mongo/base.py +++ b/common/lib/xmodule/xmodule/modulestore/mongo/base.py @@ -246,7 +246,9 @@ def location_to_query(location, wildcard=True): return query -metadata_cache_key = attrgetter('org', 'course') +def metadata_cache_key(location): + """Turn a `Location` into a useful cache key.""" + return u"{0.org}/{0.course}".format(location) class MongoModuleStore(ModuleStoreBase):