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
a4527728
Commit
a4527728
authored
Dec 10, 2011
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed the template_name parameter from View._get_template_name(), etc.
parent
64eb1056
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
12 deletions
+10
-12
pystache/view.py
+10
-12
No files found.
pystache/view.py
View file @
a4527728
...
...
@@ -80,33 +80,31 @@ class View(object):
return
self
.
template_loader
.
load_template
(
template_name
)
def
get_template
(
self
,
template_name
):
def
get_template
(
self
):
"""
Return the current template after setting it, if necessary.
"""
if
not
self
.
template
:
template_name
=
self
.
_get_template_name
(
template_name
)
template_name
=
self
.
_get_template_name
()
self
.
template
=
self
.
load_template
(
template_name
)
return
self
.
template
# TODO: consider removing the template_name parameter and using
# self.template_name instead.
def
_get_template_name
(
self
,
template_name
=
None
):
def
_get_template_name
(
self
):
"""
Return the name of this Template instance.
If
no template_name parameter is provided, this method returns the
class name modified
as follows, for example:
If
the template_name attribute is not set, then this method constructs
the template name from the class name
as follows, for example:
TemplatePartial => template_partial
TemplatePartial => template_partial
Otherwise,
it returns the given
template_name.
Otherwise,
this method returns the
template_name.
"""
if
template_name
:
return
template_name
if
self
.
template_name
:
return
self
.
template_name
template_name
=
self
.
__class__
.
__name__
...
...
@@ -127,7 +125,7 @@ class View(object):
Return the view rendered using the current context.
"""
template
=
Template
(
self
.
get_template
(
self
.
template_name
),
self
)
template
=
Template
(
self
.
get_template
(),
self
)
return
template
.
render
(
encoding
=
encoding
)
def
__contains__
(
self
,
needle
):
...
...
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