[Erp5-report] r25745 - /erp5/trunk/products/TIDStorage/repozo/repozo_tidstorage.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Feb 27 17:24:06 CET 2009
Author: luke
Date: Fri Feb 27 17:24:05 2009
New Revision: 25745
URL: http://svn.erp5.org?rev=25745&view=rev
Log:
- use TIDClient class from tests and update code with differences
- remove not needed import
Modified:
erp5/trunk/products/TIDStorage/repozo/repozo_tidstorage.py
Modified: erp5/trunk/products/TIDStorage/repozo/repozo_tidstorage.py
URL: http://svn.erp5.org/erp5/trunk/products/TIDStorage/repozo/repozo_tidstorage.py?rev=25745&r1=25744&r2=25745&view=diff
==============================================================================
--- erp5/trunk/products/TIDStorage/repozo/repozo_tidstorage.py [utf8] (original)
+++ erp5/trunk/products/TIDStorage/repozo/repozo_tidstorage.py [utf8] Fri Feb 27 17:24:05 2009
@@ -70,7 +70,9 @@
argument.
"""
+from tests.testTIDServer import TIDClient
from ExchangeProtocol import ExchangeProtocol
+
import socket
import base64
import imp
@@ -84,27 +86,12 @@
import md5
import time
import tempfile
-from struct import pack, unpack
+from struct import pack
program = sys.argv[0]
def log(message):
print message
-
-class TIDClient:
- def __init__(self, address):
- # TODO: handle diconnections nicely
- self._address = address
- self._socket = socket.socket()
- self._socket.connect(address)
- self._protocol_handler = ExchangeProtocol(socket=self._socket)
-
- def __call__(self):
- """
- Return dict currently stored on the server.
- """
- self._protocol_handler.send_field('dump')
- return self._protocol_handler.recv_dict()
def backup(address, known_tid_storage_identifier_dict, repozo_formated_command, zope_formated_url=None):
connection = TIDClient(address)
@@ -115,7 +102,7 @@
raise ValueError('It was impossible to retrieve all required TIDs. Missing: %s' % to_load)
to_load = []
load_count -= 1
- stored_tid_dict = connection()
+ stored_tid_dict = connection.dump_all()
#log(stored_tid_dict)
for key, (file_path, storage_path, object_path) in known_tid_storage_identifier_dict.iteritems():
if key not in stored_tid_dict and zope_formated_url is not None:
More information about the Erp5-report
mailing list