Commit 857431f7 by Don Mitchell

Clarify comments re behavior

parent a507ebc1
...@@ -46,12 +46,14 @@ class SplitMongoKVS(KeyValueStore): ...@@ -46,12 +46,14 @@ class SplitMongoKVS(KeyValueStore):
if key.scope == Scope.parent: if key.scope == Scope.parent:
return None return None
if key.scope == Scope.children: if key.scope == Scope.children:
# didn't find children in _fields; so, see if there's a default
raise KeyError() raise KeyError()
elif key.scope == Scope.settings: elif key.scope == Scope.settings:
# get from inheritance since not locally set # didn't find in _fields; so, get from inheritance since not locally set
if key.field_name in self._inherited_settings: if key.field_name in self._inherited_settings:
return self._inherited_settings[key.field_name] return self._inherited_settings[key.field_name]
else: else:
# or get default
raise KeyError() raise KeyError()
elif key.scope == Scope.content: elif key.scope == Scope.content:
if key.field_name == 'location': if key.field_name == 'location':
...@@ -76,7 +78,7 @@ class SplitMongoKVS(KeyValueStore): ...@@ -76,7 +78,7 @@ class SplitMongoKVS(KeyValueStore):
self._location = value # is changing this legal? self._location = value # is changing this legal?
return return
elif key.field_name == 'category': elif key.field_name == 'category':
# TODO should this raise an exception? that is, should xblock types be mungable? # TODO should this raise an exception? category is not changeable.
return return
else: else:
self._load_definition() self._load_definition()
...@@ -99,7 +101,7 @@ class SplitMongoKVS(KeyValueStore): ...@@ -99,7 +101,7 @@ class SplitMongoKVS(KeyValueStore):
if key.field_name == 'location': if key.field_name == 'location':
return # noop return # noop
elif key.field_name == 'category': elif key.field_name == 'category':
# TODO should this raise an exception? that is, should xblock types be mungable? # TODO should this raise an exception? category is not deleteable.
return # noop return # noop
else: else:
self._load_definition() self._load_definition()
...@@ -159,7 +161,7 @@ class SplitMongoKVS(KeyValueStore): ...@@ -159,7 +161,7 @@ class SplitMongoKVS(KeyValueStore):
def get_inherited_settings(self): def get_inherited_settings(self):
""" """
Get the metadata set by the ancestors (which own metadata may override or not) Get the settings set by the ancestors (which locally set fields may override or not)
""" """
return self._inherited_settings return self._inherited_settings
......
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