[Zope-CVS] CVS: Products/ExternalEditor/Plugins - winword.py:1.4

Chris McDonough chrism at plope.com
Thu Mar 3 14:22:58 EST 2005


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

Modified Files:
	winword.py 
Log Message:
If the user modified an open document, but never actively saved his outstanding changes, and instead relied on the "do you want me to save?" dialog that Word presents when choosing to exit the program, the changes would never be saved and EE would exit without an error.



=== Products/ExternalEditor/Plugins/winword.py 1.3 => 1.4 ===
--- Products/ExternalEditor/Plugins/winword.py:1.3	Mon Mar 31 17:26:18 2003
+++ Products/ExternalEditor/Plugins/winword.py	Thu Mar  3 14:22:57 2005
@@ -19,6 +19,7 @@
 import os
 from time import sleep
 import win32com
+import pythoncom
 from win32com import client # Initialize Client module
 
 class EditorProcess:
@@ -50,6 +51,16 @@
         """Returns true if the editor process is still alive"""
        	try:
             self.wordapp.Documents(self.file)
+        except pythoncom.com_error, why:
+            # COM will reject the call to access the doc if the user is
+            # doing anything interactive at the time the call is made.  The
+            # symptom is a COM error numbered -2147418111 named "Call rejected
+            # by callee".  This is most critically seen when the user has
+            # modified the document but chooses "exit" without first saving.
+            # Without this check in place, the document is not saved back to
+            # Zope, but no error is raised.
+            if why[0] == -2147418111:
+                return 1
         except:
             return 0
         else:



More information about the Zope-CVS mailing list