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
e501ec27
Commit
e501ec27
authored
13 years ago
by
Kenneth Reitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docstrings
parent
20bec630
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
0 deletions
+8
-0
pystache/template.py
+4
-0
pystache/view.py
+4
-0
No files found.
pystache/template.py
View file @
e501ec27
...
@@ -58,6 +58,8 @@ class Template(object):
...
@@ -58,6 +58,8 @@ class Template(object):
def
_compile_regexps
(
self
):
def
_compile_regexps
(
self
):
"""Compiles regular expressions, based on otag/ctag values."""
tags
=
{
tags
=
{
'otag'
:
re
.
escape
(
self
.
otag
),
'otag'
:
re
.
escape
(
self
.
otag
),
'ctag'
:
re
.
escape
(
self
.
ctag
)
'ctag'
:
re
.
escape
(
self
.
ctag
)
...
@@ -196,6 +198,8 @@ class Template(object):
...
@@ -196,6 +198,8 @@ class Template(object):
def
render
(
self
,
encoding
=
None
):
def
render
(
self
,
encoding
=
None
):
"""Returns rendered Template string."""
template
=
self
.
_render_sections
(
self
.
template
,
self
.
view
)
template
=
self
.
_render_sections
(
self
.
template
,
self
.
view
)
result
=
self
.
_render_tags
(
template
)
result
=
self
.
_render_tags
(
template
)
...
...
This diff is collapsed.
Click to expand it.
pystache/view.py
View file @
e501ec27
...
@@ -35,6 +35,7 @@ class View(object):
...
@@ -35,6 +35,7 @@ class View(object):
def
get
(
self
,
attr
,
default
=
None
):
def
get
(
self
,
attr
,
default
=
None
):
"""Returns given attribute value from View."""
attr
=
get_or_attr
(
self
.
context_list
,
attr
,
getattr
(
self
,
attr
,
default
))
attr
=
get_or_attr
(
self
.
context_list
,
attr
,
getattr
(
self
,
attr
,
default
))
...
@@ -45,6 +46,7 @@ class View(object):
...
@@ -45,6 +46,7 @@ class View(object):
def
get_template
(
self
,
template_name
):
def
get_template
(
self
,
template_name
):
"""Returns current Template."""
if
not
self
.
template
:
if
not
self
.
template
:
...
@@ -85,6 +87,8 @@ class View(object):
...
@@ -85,6 +87,8 @@ class View(object):
def
render
(
self
,
encoding
=
None
):
def
render
(
self
,
encoding
=
None
):
"""Returns rendered Template."""
template
=
Template
(
self
.
get_template
(
self
.
template_name
),
self
)
template
=
Template
(
self
.
get_template
(
self
.
template_name
),
self
)
return
template
.
render
(
encoding
=
encoding
)
return
template
.
render
(
encoding
=
encoding
)
...
...
This diff is collapsed.
Click to expand it.
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