# 需要导入模块: import sys [as 别名]
# 或者: from sys import coinit_flags [as 别名]
def InstallInWebKit(appServer):
# This function gets called by the app server during initialization.
if not appServer.setting('EnableCOM', False):
return # enabling COM was not requested
# This must be done BEFORE pythoncom is imported -- see the book mentioned above.
import sys
sys.coinit_flags = 0
# Get the win32 extensions
import pythoncom
# Set references to the COM initialize and uninitialize functions
appServer._initCOM = pythoncom.COINIT_MULTITHREADED
appServer.initCOM = pythoncom.CoInitializeEx
appServer.closeCOM = pythoncom.CoUninitialize
# Monkey-patch this instance of the appServer
# Grab references to the original initThread and delThread bound
# methods, which we will replace
appServer