Commit fed7f68f by Calen Pennington

Add a bit more context for functions

parent 4f13aecc
import xmodule import xmodule
from xmodule import progress from xmodule import progress
def XModule():
def __init__(self, content, policy, state, child_pointers, preferences):
self.content = content
self.policy = policy
self.state = state
self.child_pointers = child_pointers
self.preferences = preferences
def SequenceModule(XModule, ResourceTemplateModule): @lazy_property
def children(self):
return [xmodule.get_module(child_ptr) for child_ptr in self.child_pointers]
def __init__(self, definition, policy, state, preferences): def render(self, child, context=None):
self.state = state if context is None:
context = self.render_context
# Make children use the appropriate render context
child.render_context = context
return child.find_view(context)()
def find_view(self, context):
# self._views is populated with metaclass magic that is TBD
return self._views[context]
def SequenceModule(XModule, ResourceTemplateModule):
@property @property
def visited(self): def visited(self):
...@@ -28,7 +49,7 @@ def SequenceModule(XModule, ResourceTemplateModule): ...@@ -28,7 +49,7 @@ def SequenceModule(XModule, ResourceTemplateModule):
'main', 'main',
# Render w/ no arguments executes the same view for the children # Render w/ no arguments executes the same view for the children
# that is currently rendering for the parent # that is currently rendering for the parent
children=[child.render() for child in self.children] children=[self.render(child) for child in self.children]
) )
@xmodule.register_handler('update_position') @xmodule.register_handler('update_position')
......
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