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
8e894975
Commit
8e894975
authored
Mar 25, 2012
by
Chris Jerdonek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for Python 2.4: issue #89 (wangtz) and issue #94 (jvantuyl).
parent
9f396d87
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
24 additions
and
8 deletions
+24
-8
HISTORY.rst
+4
-0
README.rst
+6
-2
examples/nested_context.py
+6
-4
pystache/template.py
+6
-2
setup.py
+2
-0
No files found.
HISTORY.rst
View file @
8e894975
History
=======
0.4.1 (2011-03-25)
------------------
* Added support for Python 2.4. [wangtz, jvantuyl]
0.4.0 (2011-01-12)
------------------
* Add support for nested contexts (within template and view)
...
...
README.rst
View file @
8e894975
...
...
@@ -10,8 +10,12 @@ framework-agnostic way to render logic-free views.
As ctemplates says, "It emphasizes separating logic from presentation:
it is impossible to embed application logic in this template language."
Pystache is a Python implementation of Mustache. Pystache requires
Python 2.6.
Pystache is a Python implementation of Mustache. Pystache works on--
* Python 2.4
* Python 2.5
* Python 2.6
* Python 2.7
Pystache is semantically versioned: http://semver.org.
...
...
examples/nested_context.py
View file @
8e894975
...
...
@@ -11,9 +11,11 @@ class NestedContext(pystache.View):
def
derp
(
self
):
return
[{
'inner'
:
'car'
}]
def
herp
(
self
):
return
[{
'outer'
:
'car'
}]
def
nested_context_in_view
(
self
):
return
'it works!'
if
self
.
get
(
'outer'
)
==
self
.
get
(
'inner'
)
else
''
\ No newline at end of file
if
self
.
get
(
'outer'
)
==
self
.
get
(
'inner'
):
return
'it works!'
return
''
\ No newline at end of file
pystache/template.py
View file @
8e894975
...
...
@@ -53,7 +53,11 @@ class Template(object):
if
kwargs
:
context
.
update
(
kwargs
)
self
.
view
=
context
if
isinstance
(
context
,
View
)
else
View
(
context
=
context
)
if
isinstance
(
context
,
View
):
self
.
view
=
context
else
:
self
.
view
=
View
(
context
=
context
)
self
.
_compile_regexps
()
def
_compile_regexps
(
self
):
...
...
@@ -80,7 +84,7 @@ class Template(object):
replacer
=
''
# Callable
if
it
and
isinstance
(
it
,
collections
.
Callable
):
if
it
and
callable
(
it
):
replacer
=
it
(
inner
)
# Dictionary
elif
it
and
hasattr
(
it
,
'keys'
)
and
hasattr
(
it
,
'__getitem__'
):
...
...
setup.py
View file @
8e894975
...
...
@@ -35,8 +35,10 @@ setup(name='pystache',
"Development Status :: 4 - Beta"
,
"License :: OSI Approved :: MIT License"
,
"Programming Language :: Python"
,
"Programming Language :: Python :: 2.4"
,
"Programming Language :: Python :: 2.5"
,
"Programming Language :: Python :: 2.6"
,
"Programming Language :: Python :: 2.7"
,
)
)
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