[Checkins] SVN: Sandbox/malthe/chameleon.core/ Fixed bug where AttributeError would be raised when using the file cache.

Malthe Borch mborch at gmail.com
Wed Sep 24 23:27:21 EDT 2008


Log message for revision 91465:
  Fixed bug where AttributeError would be raised when using the file cache.

Changed:
  U   Sandbox/malthe/chameleon.core/CHANGES.txt
  U   Sandbox/malthe/chameleon.core/src/chameleon/core/template.py
  U   Sandbox/malthe/chameleon.core/src/chameleon/core/template.txt

-=-
Modified: Sandbox/malthe/chameleon.core/CHANGES.txt
===================================================================
--- Sandbox/malthe/chameleon.core/CHANGES.txt	2008-09-25 02:52:44 UTC (rev 91464)
+++ Sandbox/malthe/chameleon.core/CHANGES.txt	2008-09-25 03:27:21 UTC (rev 91465)
@@ -4,6 +4,9 @@
 Head
 ~~~~
 
+- Fixed bug where an AttributeError would be raised when using the
+  file cache. [malthe]
+
 1.0a1 (released 9/24/2008)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~
 

Modified: Sandbox/malthe/chameleon.core/src/chameleon/core/template.py
===================================================================
--- Sandbox/malthe/chameleon.core/src/chameleon/core/template.py	2008-09-25 02:52:44 UTC (rev 91464)
+++ Sandbox/malthe/chameleon.core/src/chameleon/core/template.py	2008-09-25 03:27:21 UTC (rev 91465)
@@ -102,10 +102,11 @@
         self.read()
 
         # persist template registry on disk
+        
         if config.DISK_CACHE:
-            self.registry = self.global_registry.setdefault(
-                filename, filecache.TemplateCache(filename))
+            self.registry = filecache.TemplateCache(filename)
 
+        self.global_registry.setdefault(filename, self)
         self.xincludes = XIncludes(
             self.global_registry, os.path.dirname(filename), self.clone)
         

Modified: Sandbox/malthe/chameleon.core/src/chameleon/core/template.txt
===================================================================
--- Sandbox/malthe/chameleon.core/src/chameleon/core/template.txt	2008-09-25 02:52:44 UTC (rev 91464)
+++ Sandbox/malthe/chameleon.core/src/chameleon/core/template.txt	2008-09-25 03:27:21 UTC (rev 91465)
@@ -42,3 +42,13 @@
     </div>
   </div>
 
+  >>> from cPickle import dumps, loads
+  >>> for key, bct in template.registry.items():
+  ...     template.registry[key] = loads(dumps(bct))
+
+  >>> print template()
+  <div>
+    <div>
+    <span>Hello, world!</span>
+    </div>
+  </div>



More information about the Checkins mailing list