[Zope-CVS] CVS: Products/Ape/lib/apelib/zope2 - scripts.py:1.3

Shane Hathaway shane@zope.com
Fri, 11 Apr 2003 23:39:38 -0400


Update of /cvs-repository/Products/Ape/lib/apelib/zope2
In directory cvs.zope.org:/tmp/cvs-serv20047/zope2

Modified Files:
	scripts.py 
Log Message:
Added tests for the bugfixes contributed by Christian Zagrodnick.

=== Products/Ape/lib/apelib/zope2/scripts.py 1.2 => 1.3 ===
--- Products/Ape/lib/apelib/zope2/scripts.py:1.2	Fri Apr 11 10:29:36 2003
+++ Products/Ape/lib/apelib/zope2/scripts.py	Fri Apr 11 23:39:38 2003
@@ -64,10 +64,14 @@
     def deserialize(self, object, event, state):
         assert isinstance(state, StringType)
         assert isinstance(object, PythonScript)
+        # Circumvent proxy role checking while deserializing the script.
         object._validateProxy = lambda: 0
-        object.write(state) 
-        object._makeFunction()
-        del(object._validateProxy)
+        try:
+            object.write(state) 
+            object._makeFunction()
+        finally:
+            # Remove the proxy circumvention
+            del object._validateProxy