[ZPT] CVS: Packages/Products/PageTemplates (Products/DC/PageTemplates) - TALES.py:1.11

evan@serenade.digicool.com evan@serenade.digicool.com
Fri, 11 May 2001 19:50:25 -0400


Update of /cvs-repository/Packages/Products/PageTemplates
In directory serenade:/home/evan/Zope/pt/lib/python/Products/PageTemplates

Modified Files:
	TALES.py 
Log Message:
Fix SafeMapping



--- Updated File TALES.py in package Packages/Products/PageTemplates --
--- TALES.py	2001/05/11 23:44:51	1.10
+++ TALES.py	2001/05/11 23:50:23	1.11
@@ -140,21 +140,17 @@
     able to read any value.
     '''
     __allow_access_to_unprotected_subobjects__ = 1
-    def __init__(self, *dicts):
-        self._mm = apply(MultiMapping, dicts)
-    def __getitem__(self, index):
-        return self._mm[index]
-    def __len__(self):
-        return len(self._mm)
-    def _push(self, arg):
-        self._mm.push(arg)
-    def _pop(self):
-        return self._mm.pop()
-    def has_key(self, key):
-        return self._mm.has_key(key)
+    push = pop = None
+    def _push(self, ob):
+        MultiMapping.push(self, ob)
+    def _pop(self, *args):
+        if args:
+            return apply(MultiMapping.pop, (self,) + args)
+        else:
+            return MultiMapping.pop(self)
     def has_get(self, key):
-        v = self._mm.get(key, self)
-        if v is self:
+        v = self.get(key, _marker)
+        if v is _marker:
             return 0, None
         else:
             return 1, v