Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pystache_custom
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
OpenEdx
pystache_custom
Commits
64eb1056
Commit
64eb1056
authored
Dec 10, 2011
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The View class constructor now accepts a loader instance.
parent
89dd6059
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
4 deletions
+17
-4
pystache/view.py
+17
-4
No files found.
pystache/view.py
View file @
64eb1056
...
...
@@ -42,7 +42,15 @@ class View(object):
template_encoding
=
None
template_extension
=
'mustache'
def
__init__
(
self
,
template
=
None
,
context
=
None
,
**
kwargs
):
template_loader
=
None
def
__init__
(
self
,
template
=
None
,
context
=
None
,
loader
=
None
,
**
kwargs
):
"""
Construct a View instance.
"""
# TODO: add a unit test for passing a loader.
self
.
template_loader
=
loader
self
.
template
=
template
context
=
context
or
{}
...
...
@@ -63,9 +71,14 @@ class View(object):
return
attr
def
load_template
(
self
,
template_name
):
loader
=
Loader
(
search_dirs
=
self
.
template_path
,
encoding
=
self
.
template_encoding
,
extension
=
self
.
template_extension
)
return
loader
.
load_template
(
template_name
)
if
self
.
template_loader
is
None
:
# We delay setting the loader until now to allow users to set
# the template_extension attribute, etc. after View.__init__()
# has already been called.
self
.
template_loader
=
Loader
(
search_dirs
=
self
.
template_path
,
encoding
=
self
.
template_encoding
,
extension
=
self
.
template_extension
)
return
self
.
template_loader
.
load_template
(
template_name
)
def
get_template
(
self
,
template_name
):
"""
...
...
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