Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.recipe.template
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Yusei Tahara
slapos.recipe.template
Commits
e9b7c1b2
Commit
e9b7c1b2
authored
Nov 25, 2014
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jinja2: add many built-in functions from Python
parent
011e2f1c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
4 deletions
+15
-4
CHANGES.txt
CHANGES.txt
+7
-2
setup.py
setup.py
+1
-1
slapos/recipe/template/jinja2_template.py
slapos/recipe/template/jinja2_template.py
+7
-1
No files found.
CHANGES.txt
View file @
e9b7c1b2
2.6 (2014-11-26)
================
* jinja2: add many built-in functions from Python.
2.5 (2013-08-07)
================
======
================
* Fix file import with Jinja2 >= 2.7
2.4.3 (2013-08-02)
==================
====
==================
* jinja2: add support for inline templates.
...
...
setup.py
View file @
e9b7c1b2
from
setuptools
import
setup
,
find_packages
import
os
version
=
'2.
5
'
version
=
'2.
6
'
name
=
'slapos.recipe.template'
long_description
=
open
(
"README.txt"
).
read
()
+
"
\
n
"
+
\
open
(
os
.
path
.
join
(
'slapos'
,
'recipe'
,
...
...
slapos/recipe/template/jinja2_template.py
View file @
e9b7c1b2
...
...
@@ -32,6 +32,12 @@ from jinja2 import Environment, StrictUndefined, \
BaseLoader
,
TemplateNotFound
,
PrefixLoader
from
contextlib
import
contextmanager
DEFAULT_CONTEXT
=
{
x
.
__name__
:
x
for
x
in
(
abs
,
all
,
any
,
bin
,
bool
,
callable
,
chr
,
complex
,
dict
,
divmod
,
enumerate
,
filter
,
float
,
format
,
frozenset
,
hex
,
int
,
isinstance
,
iter
,
len
,
list
,
map
,
max
,
min
,
next
,
oct
,
ord
,
pow
,
repr
,
reversed
,
round
,
set
,
sorted
,
str
,
sum
,
tuple
,
zip
)}
_buildout_safe_dumps
=
getattr
(
zc
.
buildout
.
buildout
,
'dumps'
,
None
)
DUMPS_KEY
=
'dumps'
DEFAULT_IMPORT_DELIMITER
=
'/'
...
...
@@ -166,7 +172,7 @@ class Recipe(object):
self
.
rendered
=
options
[
'rendered'
]
self
.
extension_list
=
[
x
for
x
in
(
y
.
strip
()
for
y
in
options
.
get
(
'extensions'
,
''
).
split
())
if
x
]
self
.
context
=
context
=
{}
self
.
context
=
context
=
DEFAULT_CONTEXT
.
copy
()
if
_buildout_safe_dumps
is
not
None
:
context
[
DUMPS_KEY
]
=
_buildout_safe_dumps
for
line
in
options
.
get
(
'context'
,
''
).
splitlines
(
False
):
...
...
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