From 8fd8574357502cf111ae11e68282192ccdc2ba48 Mon Sep 17 00:00:00 2001 From: Chris Dodge Date: Thu, 11 Apr 2013 22:10:30 -0400 Subject: [PATCH] get_items has an query ambiguity with respect to revision=None. None has a special semantic in get_items as a wildcard, so if we query with 'None' then we'll get back both draft and non-draft items. --- common/lib/xmodule/xmodule/modulestore/mongo.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/modulestore/mongo.py b/common/lib/xmodule/xmodule/modulestore/mongo.py index 653a7ca22a..9f55c6a1be 100644 --- a/common/lib/xmodule/xmodule/modulestore/mongo.py +++ b/common/lib/xmodule/xmodule/modulestore/mongo.py @@ -203,7 +203,9 @@ def location_to_query(location, wildcard=True): if wildcard: for key, value in query.items(): - if value is None: + # don't allow wildcards on revision, since public is set as None, so + # its ambiguous between None as a real value versus None=wildcard + if value is None and key != 'revision': del query[key] return query