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
b9bd807a
Commit
b9bd807a
authored
May 31, 2011
by
Carl Whittaker
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'development' of
https://github.com/lambacck/pystache
into development
parents
c9dcb076
a00b5688
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
pystache/template.py
+12
-3
setup.py
+4
-1
No files found.
pystache/template.py
View file @
b9bd807a
...
...
@@ -4,6 +4,15 @@ import collections
import
os
import
copy
try
:
import
markupsafe
escape
=
markupsafe
.
escape
literal
=
markupsafe
.
Markup
except
ImportError
:
escape
=
lambda
x
:
cgi
.
escape
(
unicode
(
x
))
literal
=
unicode
class
Modifiers
(
dict
):
"""Dictionary with a decorator for assigning functions to keys."""
...
...
@@ -89,7 +98,7 @@ class Template(object):
elif
(
not
it
and
section
[
2
]
==
'^'
)
or
(
it
and
section
[
2
]
!=
'^'
):
replacer
=
self
.
_render_dictionary
(
inner
,
it
)
template
=
template
.
replace
(
section
,
replacer
)
template
=
literal
(
template
.
replace
(
section
,
replacer
)
)
return
template
...
...
@@ -132,7 +141,7 @@ class Template(object):
else
:
return
''
return
cgi
.
escape
(
unicode
(
raw
)
)
return
escape
(
raw
)
@modifiers.set
(
'!'
)
def
_render_comment
(
self
,
tag_name
):
...
...
@@ -156,7 +165,7 @@ class Template(object):
@modifiers.set
(
'&'
)
def
render_unescaped
(
self
,
tag_name
):
"""Render a tag without escaping it."""
return
unicode
(
self
.
view
.
get
(
tag_name
,
''
))
return
literal
(
self
.
view
.
get
(
tag_name
,
''
))
def
render
(
self
,
encoding
=
None
):
template
=
self
.
_render_sections
(
self
.
template
,
self
.
view
)
...
...
setup.py
View file @
b9bd807a
...
...
@@ -3,7 +3,10 @@
import
os
import
sys
from
distutils.core
import
setup
try
:
from
setuptools
import
setup
except
ImportError
:
from
distutils.core
import
setup
def
publish
():
"""Publish to Pypi"""
...
...
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