Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: cms/converters.py

Issue 5488197752586240: Issue 2440 - implement Source.get_cache_dir() to be used by custom filters/globals (Closed)
Patch Set: Created April 30, 2015, 1:49 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cms/sources.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cms/converters.py
===================================================================
--- a/cms/converters.py
+++ b/cms/converters.py
@@ -308,16 +308,19 @@
"get_page_content": self.get_page_content,
}
+ source = self._params["source"]
self._module_refs = []
for dirname, dictionary in [("filters", filters), ("globals", globals)]:
- for filename in self._params["source"].list_files(dirname):
+ for filename in source.list_files(dirname):
root, ext = os.path.splitext(filename)
if ext.lower() != ".py":
continue
path = "%s/%s" % (dirname, filename)
- code = self._params["source"].read_file(path)
+ code = source.read_file(path)
module = imp.new_module(root.replace("/", "."))
+ if hasattr(source, "get_cache_dir"):
+ module.CMS_CACHE_DIR = source.get_cache_dir()
exec code in module.__dict__
name = os.path.basename(root)
« no previous file with comments | « no previous file | cms/sources.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld