Commit f46d70f9 authored by Bryton Lacquement's avatar Bryton Lacquement 🚪 Committed by Julien Muchembled

CMFActivity: make ActivityTool compatible with WSGI

parent c33d2d1d
...@@ -134,6 +134,9 @@ def getServerAddress(): ...@@ -134,6 +134,9 @@ def getServerAddress():
global _server_address global _server_address
if _server_address is None: if _server_address is None:
ip = port = '' ip = port = ''
try:
zopewsgi = sys.modules['Products.ERP5.bin.zopewsgi']
except KeyError:
from asyncore import socket_map from asyncore import socket_map
for k, v in socket_map.items(): for k, v in socket_map.items():
if hasattr(v, 'addr'): if hasattr(v, 'addr'):
...@@ -142,6 +145,8 @@ def getServerAddress(): ...@@ -142,6 +145,8 @@ def getServerAddress():
if type == 'ZServer.HTTPServer.zhttp_server': if type == 'ZServer.HTTPServer.zhttp_server':
ip, port = v.addr ip, port = v.addr
break break
else:
ip, port = zopewsgi.server.addr
if ip == '0.0.0.0': if ip == '0.0.0.0':
ip = socket.gethostbyname(socket.gethostname()) ip = socket.gethostbyname(socket.gethostname())
_server_address = '%s:%s' %(ip, port) _server_address = '%s:%s' %(ip, port)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment