Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
cc28d828
Commit
cc28d828
authored
13 years ago
by
Piotr Mitros
Browse files
Options
Downloads
Patches
Plain Diff
Added template_module.py, which I omitted a few commits ago
--HG-- branch : pmitros-mod-template
parent
33013a0b
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
courseware/modules/template_module.py
+29
-0
29 additions, 0 deletions
courseware/modules/template_module.py
with
29 additions
and
0 deletions
courseware/modules/template_module.py
0 → 100644
+
29
−
0
View file @
cc28d828
import
json
import
os
## TODO: Abstract out from Django
from
django.conf
import
settings
from
mitxmako.shortcuts
import
render_to_response
,
render_to_string
from
x_module
import
XModule
from
lxml
import
etree
class
Module
(
XModule
):
def
get_state
(
self
):
return
json
.
dumps
({
})
@classmethod
def
get_xml_tags
(
c
):
tags
=
os
.
listdir
(
settings
.
DATA_DIR
+
'
/custom_tags
'
)
return
tags
def
get_html
(
self
):
return
self
.
html
def
__init__
(
self
,
xml
,
item_id
,
ajax_url
=
None
,
track_url
=
None
,
state
=
None
,
track_function
=
None
,
render_function
=
None
):
XModule
.
__init__
(
self
,
xml
,
item_id
,
ajax_url
,
track_url
,
state
,
track_function
,
render_function
)
xmltree
=
etree
.
fromstring
(
xml
)
filename
=
xmltree
.
tag
params
=
dict
(
xmltree
.
items
())
print
params
self
.
html
=
render_to_string
(
'
custom_tags/
'
+
filename
,
params
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment