Skip to content
Snippets Groups Projects
Commit 3cad4642 authored by Mike Bayer's avatar Mike Bayer
Browse files

caching layer for ns...

parent 2c653240
No related branches found
No related tags found
No related merge requests found
...@@ -99,8 +99,13 @@ class Namespace(object): ...@@ -99,8 +99,13 @@ class Namespace(object):
def get_namespace(self, filename): def get_namespace(self, filename):
"""return a namespace corresponding to the given template filename.""" """return a namespace corresponding to the given template filename."""
# TODO: add a caching layer here key = (self, filename)
return Namespace(filename, self.context, templateuri=filename, calling_uri=self._templateuri) if self.context.namespaces.has_key(key):
return context.namespaces[key]
else:
ns = Namespace(filename, self.context, templateuri=filename, calling_uri=self._templateuri)
self.context.namespaces[key] = ns
return ns
def populate(self, d, l): def populate(self, d, l):
for ident in l: for ident in l:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment