diff genshi/template/loader.py @ 902:09cc3627654c experimental-inline

Sync `experimental/inline` branch with [source:trunk@1126].
author cmlenz
date Fri, 23 Apr 2010 21:08:26 +0000
parents de82830f8816
children
line wrap: on
line diff
--- a/genshi/template/loader.py
+++ b/genshi/template/loader.py
@@ -1,6 +1,6 @@
 # -*- coding: utf-8 -*-
 #
-# Copyright (C) 2006-2008 Edgewall Software
+# Copyright (C) 2006-2010 Edgewall Software
 # All rights reserved.
 #
 # This software is licensed as described in the file COPYING, which
@@ -131,6 +131,15 @@
         self._uptodate = {}
         self._lock = threading.RLock()
 
+    def __getstate__(self):
+        state = self.__dict__.copy()
+        state['_lock'] = None
+        return state
+
+    def __setstate__(self, state):
+        self.__dict__ = state
+        self._lock = threading.RLock()
+
     def load(self, filename, relative_to=None, cls=None, encoding=None):
         """Load the template with the given name.
         
@@ -308,9 +317,9 @@
         ...     app1 = lambda filename: ('app1', filename, None, None),
         ...     app2 = lambda filename: ('app2', filename, None, None)
         ... )
-        >>> print load('app1/foo.html')
+        >>> print(load('app1/foo.html'))
         ('app1', 'app1/foo.html', None, None)
-        >>> print load('app2/bar.html')
+        >>> print(load('app2/bar.html'))
         ('app2', 'app2/bar.html', None, None)
         
         :param delegates: mapping of path prefixes to loader functions
@@ -326,7 +335,7 @@
                         filename[len(prefix):].lstrip('/\\')
                     )
                     return filepath, filename, fileobj, uptodate
-            raise TemplateNotFound(filename, delegates.keys())
+            raise TemplateNotFound(filename, list(delegates.keys()))
         return _dispatch_by_prefix
 
 
Copyright (C) 2012-2017 Edgewall Software