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

Unified Diff: cms/sources.py

Issue 5703725486178304: Issue 2563 - [cms] Cache filters and globals during page generation (Closed)
Patch Set: Created May 20, 2015, 3:51 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 | « cms/converters.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cms/sources.py
===================================================================
--- a/cms/sources.py
+++ b/cms/sources.py
@@ -67,6 +67,16 @@
config.readfp(StringIO(configdata))
return config
+ def import_symbol(self, filename, symbol):
+ code = self.read_file(filename)
+ namespace = {}
Sebastian Noack 2015/05/20 16:01:39 Note that I refactored this logic while moving it
+ exec code in namespace
+
+ try:
+ return namespace[symbol]
+ except KeyError:
+ raise Exception("Expected symbol %s not found in %s" % (symbol, filename))
+
#
# Page helpers
#
« no previous file with comments | « cms/converters.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld