fixed babel entry point
authorArmin Ronacher <armin.ronacher@active-4.com>
Tue, 20 May 2008 15:52:52 +0000 (17:52 +0200)
committerArmin Ronacher <armin.ronacher@active-4.com>
Tue, 20 May 2008 15:52:52 +0000 (17:52 +0200)
--HG--
branch : trunk

jinja2/utils.py
setup.py

index 529abd2794ad1b018ee606be598a30b852a6e710..90eb737811ea93edcbc179ec879a00c0c5bd600d 100644 (file)
@@ -364,7 +364,9 @@ class LRUCache(object):
         self.capacity = capacity
         self._mapping = {}
         self._queue = deque()
+        self._postinit()
 
+    def _postinit(self):
         # alias all queue methods for faster lookup
         self._popleft = self._queue.popleft
         self._pop = self._queue.pop
@@ -380,6 +382,20 @@ class LRUCache(object):
                 del self._queue[idx]
                 break
 
+    def __getstate__(self):
+        return {
+            'capacity':     self.capacity,
+            '_mapping':     self._mapping,
+            '_queue':       self._queue
+        }
+
+    def __setstate__(self, d):
+        self.__dict__.update(d)
+        self._postinit()
+
+    def __getnewargs__(self):
+        return (self.capacity,)
+
     def copy(self):
         """Return an shallow copy of the instance."""
         rv = self.__class__(self.capacity)
index 7fe263d7fc62ae955ecb90d80b787f2b24ab78b4..fd7d3f5bddc288b0dd07a7f9256c7076642c136d 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -133,6 +133,6 @@ setup(
     extras_require={'i18n': ['Babel>=0.8']},
     entry_points="""
     [babel.extractors]
-    jinja2 = jinja.ext:babel_extract[i18n]
+    jinja2 = jinja2.ext:babel_extract[i18n]
     """
 )