[Erp5-report] r46067 jm - /erp5/trunk/utils/Products.TIDStorage/Products/TIDStorage/

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Jun 21 18:49:16 UTC 2019


Author: jm
Date: Fri Jun 21 18:49:16 2019
New Revision: 46067

URL: http://svn.erp5.org?rev=46067&view=rev
Log:
TIDStorage: depend on recent ERP5 rather than on Medusa HTTP server

TIDStorage is legacy software and https://neo.nexedi.com/
is now used instead of multi-ZEO setups.

TIDStorage is only used by a few existing ERP5 instances
and this commit is required to switch them to WSGI.

Modified:
    erp5/trunk/utils/Products.TIDStorage/Products/TIDStorage/transaction_transaction.py

Modified: erp5/trunk/utils/Products.TIDStorage/Products/TIDStorage/transaction_transaction.py
URL: http://svn.erp5.org/erp5/trunk/utils/Products.TIDStorage/Products/TIDStorage/transaction_transaction.py?rev=46067&r1=46066&r2=46067&view=diff
==============================================================================
--- erp5/trunk/utils/Products.TIDStorage/Products/TIDStorage/transaction_transaction.py [utf8] (original)
+++ erp5/trunk/utils/Products.TIDStorage/Products/TIDStorage/transaction_transaction.py [utf8] Fri Jun 21 18:49:16 2019
@@ -71,25 +71,15 @@ LOG('TIDStorage',INFO,'Monkey patching t
     '_commitResources, connected to %s' % ':'.join([str(q) for q in
       TID_STORAGE_ADDRESS]))
 
-# Borrowed from CMFActivity.ActivityTool.getCurrentNode
+from Products.CMFActivity.ActivityTool import getServerAddress
 def getZopeId():
   """ Return current node in form ip:port """
   global zope_identifier
   if zope_identifier is None:
-    port = ''
-    from asyncore import socket_map
-    for k, v in socket_map.items():
-      if hasattr(v, 'port') and hasattr(v, 'ip'):
-        # see Zope/lib/python/App/ApplicationManager.py: def getServers(self)
-        type = str(getattr(v, '__class__', 'unknown'))
-        if type == 'ZServer.HTTPServer.zhttp_server':
-          port = v.port
-          ip = v.ip
-          break
-    assert port != '', 'zhttp_server not started yet'
+    zope_identifier = getServerAddress()
     if TID_STORAGE_ADDRESS[0] != '127.0.0.1':
-      assert ip != '127.0.0.1', 'self address must not be 127.0.0.1 if TIDStorage is remote'
-    zope_identifier = '%s:%s' %(ip, port)
+      assert not zope_identifier.startswith('127.0.0.1:'), \
+        'self address must not be 127.0.0.1 if TIDStorage is remote'
   return zope_identifier
 
 def getFilestorageList(resource_list):



More information about the Erp5-report mailing list