projects
/
invirt/packages/invirt-web.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Allow global imports to be specified for Mako templates
[invirt/packages/invirt-web.git]
/
code
/
view.py
diff --git
a/code/view.py
b/code/view.py
index
5d4750d
..
87a527b
100644
(file)
--- a/
code/view.py
+++ b/
code/view.py
@@
-29,7
+29,8
@@
class MakoLoader(object):
self.lookups = {}
def __call__(self, filename, directories, module_directory=None,
self.lookups = {}
def __call__(self, filename, directories, module_directory=None,
- collection_size=-1, content_type='text/html; charset=utf-8'):
+ collection_size=-1, content_type='text/html; charset=utf-8',
+ imports=[]):
# Find the appropriate template lookup.
key = (tuple(directories), module_directory)
try:
# Find the appropriate template lookup.
key = (tuple(directories), module_directory)
try:
@@
-41,6
+42,7
@@
class MakoLoader(object):
default_filters=['decode.utf8'],
input_encoding='utf-8',
output_encoding='utf-8',
default_filters=['decode.utf8'],
input_encoding='utf-8',
output_encoding='utf-8',
+ imports=imports,
)
self.lookups[key] = lookup
cherrypy.request.lookup = lookup
)
self.lookups[key] = lookup
cherrypy.request.lookup = lookup