[Checkins] SVN: z3c.pt/trunk/ Use a global template registry for file-system templates.
Malthe Borch
mborch at gmail.com
Sat Aug 23 08:40:23 EDT 2008
Log message for revision 90145:
Use a global template registry for file-system templates.
Changed:
U z3c.pt/trunk/CHANGES.txt
U z3c.pt/trunk/src/z3c/pt/template.py
-=-
Modified: z3c.pt/trunk/CHANGES.txt
===================================================================
--- z3c.pt/trunk/CHANGES.txt 2008-08-23 12:39:46 UTC (rev 90144)
+++ z3c.pt/trunk/CHANGES.txt 2008-08-23 12:40:22 UTC (rev 90145)
@@ -4,6 +4,10 @@
Version 1.0dev
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+- Use a global template registry for templates on the
+ file-system. This makes it inexpensive to have multiple template
+ class instances pointing to the same file. [malthe]
+
- Reimplemented the disk cache to correctly restore all template
data. This implementation keeps a cache in a pickled format in a
file next to the original template. [malthe]
Modified: z3c.pt/trunk/src/z3c/pt/template.py
===================================================================
--- z3c.pt/trunk/src/z3c/pt/template.py 2008-08-23 12:39:46 UTC (rev 90144)
+++ z3c.pt/trunk/src/z3c/pt/template.py 2008-08-23 12:40:22 UTC (rev 90145)
@@ -62,6 +62,8 @@
will be recompiled if it has been changed since the last
rendering."""
+ global_registry = {}
+
def __init__(self, filename, parser, auto_reload=False):
BaseTemplate.__init__(
self, None, parser)
@@ -78,7 +80,8 @@
# persist template registry on disk
if config.DISK_CACHE:
- self.registry = filecache.TemplateCache(filename)
+ self.registry = self.global_registry.setdefault(
+ filename, filecache.TemplateCache(filename))
def _get_filename(self):
return getattr(self, '_filename', None)
More information about the Checkins
mailing list