Commit bb66cad6 by Piotr Mitros

Code review -- comments and better exceptions

parent abdd696f
...@@ -64,6 +64,10 @@ class SimpleInput():# XModule ...@@ -64,6 +64,10 @@ class SimpleInput():# XModule
self.tag = xml.tag self.tag = xml.tag
if not state: if not state:
state = {} state = {}
## ID should only come from one place.
## If it comes from multiple, we use state first, XML second, and parameter
## third. Since we don't make this guarantee, we can swap this around in
## the future if there's a more logical order.
if item_id: if item_id:
self.id = item_id self.id = item_id
if xml.get('id'): if xml.get('id'):
...@@ -132,7 +136,7 @@ def register_render_function(fn, names=None, cls=SimpleInput): ...@@ -132,7 +136,7 @@ def register_render_function(fn, names=None, cls=SimpleInput):
if names == None: if names == None:
SimpleInput.xml_tags[fn.__name__] = fn SimpleInput.xml_tags[fn.__name__] = fn
else: else:
raise "Unimplemented/input types" raise NotImplementedError
def wrapped(): def wrapped():
return fn return fn
return wrapped return wrapped
......
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