Files
edx-platform/courseware/x_module.py
2011-12-07 22:52:53 -05:00

38 lines
1.0 KiB
Python

class XModule:
''' Implements a generic learning module.
Initialized on access with __init__, first time with state=None, and
then with state
'''
def get_xml_tags():
''' Tags in the courseware file guaranteed to correspond to the module '''
return []
def get_id_attribute():
''' An attribute in the XML scheme that is guaranteed unique. '''
return "name"
def get_state(self):
return ""
def get_score(self):
return None
def max_score(self):
return None
def get_html(self):
return "Unimplemented"
def handle_ajax(self, dispatch, get):
''' dispatch is last part of the URL.
get is a dictionary-like object '''
return ""
def __init__(self, xml, item_id, ajax_url=None, track_url=None, state=None):
''' In most cases, you must pass state or xml'''
self.xml=xml
self.item_id=item_id
self.ajax_url=ajax_url
self.track_url=track_url
self.state=state