mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-10 23:42:37 -07:00
Bump cherrypy from 18.8.0 to 18.9.0 (#2266)
* Bump cherrypy from 18.8.0 to 18.9.0 Bumps [cherrypy](https://github.com/cherrypy/cherrypy) from 18.8.0 to 18.9.0. - [Changelog](https://github.com/cherrypy/cherrypy/blob/main/CHANGES.rst) - [Commits](https://github.com/cherrypy/cherrypy/compare/v18.8.0...v18.9.0) --- updated-dependencies: - dependency-name: cherrypy dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update cherrypy==18.9.0 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
cfefa928be
commit
faef9a94c4
673 changed files with 159850 additions and 11583 deletions
84
lib/win32com/server/connect.py
Normal file
84
lib/win32com/server/connect.py
Normal file
|
@ -0,0 +1,84 @@
|
|||
"""Utilities for Server Side connections.
|
||||
|
||||
A collection of helpers for server side connection points.
|
||||
"""
|
||||
import pythoncom
|
||||
import win32com.server.util
|
||||
import winerror
|
||||
from win32com import olectl
|
||||
|
||||
from .exception import Exception
|
||||
|
||||
# Methods implemented by the interfaces.
|
||||
IConnectionPointContainer_methods = ["EnumConnectionPoints", "FindConnectionPoint"]
|
||||
IConnectionPoint_methods = [
|
||||
"EnumConnections",
|
||||
"Unadvise",
|
||||
"Advise",
|
||||
"GetConnectionPointContainer",
|
||||
"GetConnectionInterface",
|
||||
]
|
||||
|
||||
|
||||
class ConnectableServer:
|
||||
_public_methods_ = IConnectionPointContainer_methods + IConnectionPoint_methods
|
||||
_com_interfaces_ = [
|
||||
pythoncom.IID_IConnectionPoint,
|
||||
pythoncom.IID_IConnectionPointContainer,
|
||||
]
|
||||
|
||||
# Clients must set _connect_interfaces_ = [...]
|
||||
def __init__(self):
|
||||
self.cookieNo = 0
|
||||
self.connections = {}
|
||||
|
||||
# IConnectionPoint interfaces
|
||||
def EnumConnections(self):
|
||||
raise Exception(winerror.E_NOTIMPL)
|
||||
|
||||
def GetConnectionInterface(self):
|
||||
raise Exception(winerror.E_NOTIMPL)
|
||||
|
||||
def GetConnectionPointContainer(self):
|
||||
return win32com.server.util.wrap(self)
|
||||
|
||||
def Advise(self, pUnk):
|
||||
# Creates a connection to the client. Simply allocate a new cookie,
|
||||
# find the clients interface, and store it in a dictionary.
|
||||
try:
|
||||
interface = pUnk.QueryInterface(
|
||||
self._connect_interfaces_[0], pythoncom.IID_IDispatch
|
||||
)
|
||||
except pythoncom.com_error:
|
||||
raise Exception(scode=olectl.CONNECT_E_NOCONNECTION)
|
||||
self.cookieNo = self.cookieNo + 1
|
||||
self.connections[self.cookieNo] = interface
|
||||
return self.cookieNo
|
||||
|
||||
def Unadvise(self, cookie):
|
||||
# Destroy a connection - simply delete interface from the map.
|
||||
try:
|
||||
del self.connections[cookie]
|
||||
except KeyError:
|
||||
raise Exception(scode=winerror.E_UNEXPECTED)
|
||||
|
||||
# IConnectionPointContainer interfaces
|
||||
def EnumConnectionPoints(self):
|
||||
raise Exception(winerror.E_NOTIMPL)
|
||||
|
||||
def FindConnectionPoint(self, iid):
|
||||
# Find a connection we support. Only support the single event interface.
|
||||
if iid in self._connect_interfaces_:
|
||||
return win32com.server.util.wrap(self)
|
||||
|
||||
def _BroadcastNotify(self, broadcaster, extraArgs):
|
||||
# Broadcasts a notification to all connections.
|
||||
# Ignores clients that fail.
|
||||
for interface in self.connections.values():
|
||||
try:
|
||||
broadcaster(*(interface,) + extraArgs)
|
||||
except pythoncom.com_error as details:
|
||||
self._OnNotifyFail(interface, details)
|
||||
|
||||
def _OnNotifyFail(self, interface, details):
|
||||
print("Ignoring COM error to connection - %s" % (repr(details)))
|
Loading…
Add table
Add a link
Reference in a new issue