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
8f2ef63a
Commit
8f2ef63a
authored
Jan 01, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deleted the Modifiers class, which is no longer used.
parent
52349a8b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
32 deletions
+0
-32
pystache/renderengine.py
+0
-32
No files found.
pystache/renderengine.py
View file @
8f2ef63a
...
...
@@ -22,30 +22,6 @@ except ImportError:
return
hasattr
(
it
,
'__call__'
)
class
Modifiers
(
dict
):
"""Dictionary with a decorator for assigning functions to keys."""
def
set
(
self
,
key
):
"""
Return a decorator that assigns the given function to the given key.
>>> modifiers = Modifiers()
>>>
>>> @modifiers.set('P')
... def render_tongue(tag_name, context):
... return "
%
s :P"
%
context.get(tag_name)
>>>
>>> modifiers['P']('text', {'text': 'hello!'})
'hello! :P'
"""
def
decorate
(
func
):
self
[
key
]
=
func
return
func
return
decorate
class
RenderEngine
(
object
):
"""
...
...
@@ -68,8 +44,6 @@ class RenderEngine(object):
otag
=
'{{'
ctag
=
'}}'
modifiers
=
Modifiers
()
def
__init__
(
self
,
load_partial
=
None
,
literal
=
None
,
escape
=
None
):
"""
Arguments:
...
...
@@ -210,7 +184,6 @@ class RenderEngine(object):
return
val
@modifiers.set
(
None
)
def
_render_escaped
(
self
,
tag_name
):
"""
Return a variable value as an escaped unicode string.
...
...
@@ -219,8 +192,6 @@ class RenderEngine(object):
s
=
self
.
_get_string_context
(
tag_name
)
return
self
.
escape
(
s
)
@modifiers.set
(
'{'
)
@modifiers.set
(
'&'
)
def
_render_literal
(
self
,
tag_name
):
"""
Return a variable value as a unicode string (unescaped).
...
...
@@ -229,16 +200,13 @@ class RenderEngine(object):
s
=
self
.
_get_string_context
(
tag_name
)
return
self
.
literal
(
s
)
@modifiers.set
(
'!'
)
def
_render_comment
(
self
,
tag_name
):
return
''
@modifiers.set
(
'>'
)
def
_render_partial
(
self
,
template_name
):
template
=
self
.
load_partial
(
template_name
)
return
self
.
_render
(
template
)
@modifiers.set
(
'='
)
def
_change_delimiter
(
self
,
tag_name
):
"""
Change the current delimiter.
...
...
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