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
dbfcd78c
Commit
dbfcd78c
authored
Jul 10, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get custom_tag templates using system.filestore so that they work in multicourse
parent
239c5ef1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
9 deletions
+5
-9
common/lib/xmodule/xmodule/template_module.py
+4
-2
lms/envs/common.py
+1
-7
No files found.
common/lib/xmodule/xmodule/template_module.py
View file @
dbfcd78c
from
xmodule.x_module
import
XModule
from
xmodule.raw_module
import
RawDescriptor
from
lxml
import
etree
from
mako.template
import
Template
class
CustomTagModule
(
XModule
):
...
...
@@ -30,9 +31,10 @@ class CustomTagModule(XModule):
def
__init__
(
self
,
system
,
location
,
definition
,
instance_state
=
None
,
shared_state
=
None
,
**
kwargs
):
XModule
.
__init__
(
self
,
system
,
location
,
definition
,
instance_state
,
shared_state
,
**
kwargs
)
xmltree
=
etree
.
fromstring
(
self
.
definition
[
'data'
])
file
name
=
xmltree
.
find
(
'impl'
)
.
text
template_
name
=
xmltree
.
find
(
'impl'
)
.
text
params
=
dict
(
xmltree
.
items
())
self
.
html
=
self
.
system
.
render_template
(
filename
,
params
,
namespace
=
'custom_tags'
)
with
self
.
system
.
filestore
.
open
(
'custom_tags/{name}'
.
format
(
name
=
template_name
))
as
template
:
self
.
html
=
Template
(
template
.
read
())
.
render
(
**
params
)
def
get_html
(
self
):
return
self
.
html
...
...
lms/envs/common.py
View file @
dbfcd78c
...
...
@@ -69,21 +69,15 @@ sys.path.append(COMMON_ROOT / 'lib')
# templates
MAKO_MODULE_DIR
=
tempfile
.
mkdtemp
(
'mako'
)
MAKO_TEMPLATES
=
{}
MAKO_TEMPLATES
[
'course'
]
=
[
DATA_DIR
]
MAKO_TEMPLATES
[
'sections'
]
=
[
DATA_DIR
/
'sections'
]
MAKO_TEMPLATES
[
'custom_tags'
]
=
[
DATA_DIR
/
'custom_tags'
]
MAKO_TEMPLATES
[
'main'
]
=
[
PROJECT_ROOT
/
'templates'
,
COMMON_ROOT
/
'templates'
,
COMMON_ROOT
/
'lib'
/
'capa'
/
'templates'
,
COMMON_ROOT
/
'djangoapps'
/
'pipeline_mako'
/
'templates'
,
DATA_DIR
/
'info'
,
DATA_DIR
/
'problems'
]
COMMON_ROOT
/
'djangoapps'
/
'pipeline_mako'
/
'templates'
]
# This is where Django Template lookup is defined. There are a few of these
# still left lying around.
TEMPLATE_DIRS
=
(
PROJECT_ROOT
/
"templates"
,
DATA_DIR
/
"problems"
,
)
TEMPLATE_CONTEXT_PROCESSORS
=
(
...
...
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