Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
c91ea8fc
Commit
c91ea8fc
authored
Nov 15, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update the __init__ for XModule to the new interface specification
parent
744652d7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
54 deletions
+15
-54
common/lib/xmodule/xmodule/vertical_module.py
+0
-4
common/lib/xmodule/xmodule/xmodule.py
+15
-50
No files found.
common/lib/xmodule/xmodule/vertical_module.py
View file @
c91ea8fc
...
@@ -10,10 +10,6 @@ class_priority = ['video', 'problem']
...
@@ -10,10 +10,6 @@ class_priority = ['video', 'problem']
class
VerticalModule
(
XModule
):
class
VerticalModule
(
XModule
):
''' Layout module for laying out submodules vertically.'''
''' Layout module for laying out submodules vertically.'''
def
__init__
(
self
,
system
,
location
,
definition
,
descriptor
,
instance_state
=
None
,
shared_state
=
None
,
**
kwargs
):
XModule
.
__init__
(
self
,
system
,
location
,
definition
,
descriptor
,
instance_state
,
shared_state
,
**
kwargs
)
self
.
contents
=
None
def
get_html
(
self
):
def
get_html
(
self
):
if
self
.
contents
is
None
:
if
self
.
contents
is
None
:
self
.
contents
=
[
child
.
get_html
()
for
child
in
self
.
get_display_items
()]
self
.
contents
=
[
child
.
get_html
()
for
child
in
self
.
get_display_items
()]
...
...
common/lib/xmodule/xmodule/xmodule.py
View file @
c91ea8fc
...
@@ -152,64 +152,32 @@ class XModule(Plugin, HTMLSnippet):
...
@@ -152,64 +152,32 @@ class XModule(Plugin, HTMLSnippet):
entry_point
=
"xmodule.v2"
entry_point
=
"xmodule.v2"
def
__init__
(
self
,
system
,
location
,
definition
,
descriptor
,
def
__init__
(
self
,
runtime
,
content
,
course_settings
,
user_preferences
,
student_state
,
*
args
,
**
kwargs
):
instance_state
=
None
,
shared_state
=
None
,
**
kwargs
):
'''
'''
Construct a new xmodule
Construct a new xmodule
system
: A ModuleSystem allowing access to external resources
runtime
: A ModuleSystem allowing access to external resources
location: Something Location-like that identifies this xmodule
content: A dictionary containing the data that the content author
created to define this module instance
definition: A dictionary containing 'data' and 'children'. Both ar
e
course_settings: A dictionary containing the data that describes how the modul
e
optional
should operate
'data': is JSON-like (string, dictionary, list, bool, or None,
user_preferences: A dictionary containing the data that describes the
optionally nested).
global preferences for this user about this module type
This defines all of the data necessary for a problem to display
student_state: A dictionary containing the data that a student has
that is intrinsic to the problem. It should not include any
entered for this module
data that would vary between two courses using the same problem
(due dates, grading policy, randomization, etc.)
'children': is a list of Location-like values for child modules that
this module depends on
descriptor: the XModuleDescriptor that this module is an instance of.
TODO (vshnayder): remove the definition parameter and location--they
can come from the descriptor.
instance_state: A string of serialized json that contains the state of
this module for current student accessing the system, or None if
no state has been saved
shared_state: A string of serialized json that contains the state that
is shared between this module and any modules of the same type with
the same shared_state_key. This state is only shared per-student,
not across different students
kwargs: Optional arguments. Subclasses should always accept kwargs and
kwargs: Optional arguments. Subclasses should always accept kwargs and
pass them to the parent class constructor.
pass them to the parent class constructor.
Current known uses of kwargs:
metadata: SCAFFOLDING - This dictionary will be split into
several different types of metadata in the future (course
policy, modification history, etc). A dictionary containing
data that specifies information that is particular to a
problem in the context of a course
'''
'''
self
.
system
=
system
self
.
runtime
=
runtime
self
.
location
=
Location
(
location
)
self
.
content
=
content
self
.
definition
=
definition
self
.
course_settings
=
course_settings
self
.
descriptor
=
descriptor
self
.
user_preferences
=
user_preferences
self
.
instance_state
=
instance_state
self
.
student_state
=
student_state
self
.
shared_state
=
shared_state
self
.
id
=
self
.
location
.
url
()
self
.
url_name
=
self
.
location
.
name
self
.
category
=
self
.
location
.
category
self
.
metadata
=
kwargs
.
get
(
'metadata'
,
{})
self
.
_loaded_children
=
None
@property
@property
def
display_name
(
self
):
def
display_name
(
self
):
...
@@ -220,9 +188,6 @@ class XModule(Plugin, HTMLSnippet):
...
@@ -220,9 +188,6 @@ class XModule(Plugin, HTMLSnippet):
return
self
.
metadata
.
get
(
'display_name'
,
return
self
.
metadata
.
get
(
'display_name'
,
self
.
url_name
.
replace
(
'_'
,
' '
))
self
.
url_name
.
replace
(
'_'
,
' '
))
def
__unicode__
(
self
):
return
'<x_module(id={0})>'
.
format
(
self
.
id
)
def
get_children
(
self
):
def
get_children
(
self
):
'''
'''
Return module instances for all the children of this module.
Return module instances for all the children of this module.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment