[Zope-CVS] CVS: Products/ExternalEditor - CHANGES.txt:1.20 version.txt:1.5 zopeedit.py:1.30

Casey Duncan casey@zope.com
Sat, 29 Jun 2002 01:03:39 -0400


Update of /cvs-repository/Products/ExternalEditor
In directory cvs.zope.org:/tmp/cvs-serv8293

Modified Files:
	CHANGES.txt version.txt zopeedit.py 
Log Message:
Fixed dangling dav lock bug
Final commit for ver 0.4.1


=== Products/ExternalEditor/CHANGES.txt 1.19 => 1.20 ===
 
+  6/29/02 - 0.4.1 Release
+
+    - Fixed dangling dav lock bug on fatal errors. Thanks to Marc St-Jean.
+
     - Fixed content_type bug, now checks if it is callable. Thanks to Arnaud 
-      Bienvenu
+      Bienvenu.
 
     - Fixed bug with editing binary data on Windows. Thanks to Eric Kamm.
 


=== Products/ExternalEditor/version.txt 1.4 => 1.5 ===
+0.4.1


=== Products/ExternalEditor/zopeedit.py 1.29 => 1.30 ===
         
     def __del__(self):
-        # for security we always delete the files by default
         if getattr(self, 'clean_up', 1) and hasattr(self, 'content_file'):
+            # for security we always delete the files by default
             os.remove(self.content_file)
+
+        if hasattr(self, 'lock_token'):
+            # Try not to leave dangling locks on the server
+            self.unlock(interactive=0)
             
     def getEditorCommand(self):
         """Return the editor command"""
@@ -404,7 +408,7 @@
                 return 0
         return 1
                     
-    def unlock(self):
+    def unlock(self, interactive=1):
         """Remove webdav lock from edited zope object"""
         if not hasattr(self, 'lock_token'): 
             return 0
@@ -412,7 +416,7 @@
         headers = {'Lock-Token':self.lock_token}
         response = self.zopeRequest('UNLOCK', headers)
         
-        if response.status / 100 != 2:
+        if interactive and response.status / 100 != 2:
             # Captain, she's still locked!
             if self.askRetryAfterError(response, 
                                        'Unlock request failed'):