[Erp5-report] r25801 - in /erp5/trunk/products/TIDStorage: bin/ repozo/
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Mar 3 10:44:45 CET 2009
Author: luke
Date: Tue Mar 3 10:44:43 2009
New Revision: 25801
URL: http://svn.erp5.org?rev=25801&view=rev
Log:
- method name corresponds its functionality
Modified:
erp5/trunk/products/TIDStorage/bin/tidstorage.py
erp5/trunk/products/TIDStorage/repozo/repozo_tidstorage.py
Modified: erp5/trunk/products/TIDStorage/bin/tidstorage.py
URL: http://svn.erp5.org/erp5/trunk/products/TIDStorage/bin/tidstorage.py?rev=25801&r1=25800&r2=25801&view=diff
==============================================================================
--- erp5/trunk/products/TIDStorage/bin/tidstorage.py [utf8] (original)
+++ erp5/trunk/products/TIDStorage/bin/tidstorage.py [utf8] Tue Mar 3 10:44:43 2009
@@ -493,7 +493,7 @@
daemon_threads = True
allow_reuse_address = True
-def main(address, port):
+def server(address, port):
server = PoliteThreadingTCPServer((address, port), TIDServer)
try:
try:
@@ -703,7 +703,7 @@
os.close(1)
os.close(2)
sys.stdout = sys.stderr = logfile
- main(options.address, options.port)
+ server(options.address, options.port)
log('Exiting.')
else:
pidfile.write(str(pid))
@@ -712,5 +712,5 @@
else:
os._exit(0)
else:
- main(options.address, options.port)
-
+ server(options.address, options.port)
+
Modified: erp5/trunk/products/TIDStorage/repozo/repozo_tidstorage.py
URL: http://svn.erp5.org/erp5/trunk/products/TIDStorage/repozo/repozo_tidstorage.py?rev=25801&r1=25800&r2=25801&view=diff
==============================================================================
--- erp5/trunk/products/TIDStorage/repozo/repozo_tidstorage.py [utf8] (original)
+++ erp5/trunk/products/TIDStorage/repozo/repozo_tidstorage.py [utf8] Tue Mar 3 10:44:43 2009
@@ -298,43 +298,46 @@
return options
-options = parseargs()
-address = (options.host, options.port)
-zope_formated_url = options.base_url
-if options.base_url is not None and '%s' not in zope_formated_url:
- raise ValueError, 'Given base url (%r) is not properly formated, it must contain one \'%%s\'.' % (zope_formated_url, )
-repozo_formated_command = '%s %s -r "%%s"' % (options.repozo_file_name, ' '.join(options.repozo_opts))
-if options.recover:
- timestamp_file = open(options.timestamp_file_path, 'r')
- timestamp = ''
- read_line = ' '
- while len(read_line):
- timestamp = read_line
- read_line = timestamp_file.readline()
- timestamp = timestamp.strip('\r\n \t')
- if timestamp is not None:
- repozo_formated_command += ' -o "%%s" -D %s' % (timestamp, )
- result = recover(
- known_tid_storage_identifier_dict=options.known_tid_storage_identifier_dict,
- repozo_formated_command=repozo_formated_command,
- check=options.dry_run)
-else:
- repozo_formated_command += ' -f "%s" -m "%s"'
- result = backup(
- address=address,
- known_tid_storage_identifier_dict=options.known_tid_storage_identifier_dict,
- zope_formated_url=zope_formated_url,
- repozo_formated_command=repozo_formated_command)
- if result == 0:
- # Paranoid mode:
- # Issue a system-wide "sync" command to make sure all files which were saved
- # are really present on disk.
- os.system('sync')
- timestamp_file = open(options.timestamp_file_path, 'a', 0)
- try:
- # Borrowed from repozo.
- timestamp_file.write('\n%04d-%02d-%02d-%02d-%02d-%02d' % time.gmtime()[:6])
- finally:
- timestamp_file.close()
-
-sys.exit(result)
+def main():
+ options = parseargs()
+ address = (options.host, options.port)
+ zope_formated_url = options.base_url
+ if options.base_url is not None and '%s' not in zope_formated_url:
+ raise ValueError, 'Given base url (%r) is not properly formated, it must contain one \'%%s\'.' % (zope_formated_url, )
+ repozo_formated_command = '%s %s -r "%%s"' % (options.repozo_file_name, ' '.join(options.repozo_opts))
+ if options.recover:
+ timestamp_file = open(options.timestamp_file_path, 'r')
+ timestamp = ''
+ read_line = ' '
+ while len(read_line):
+ timestamp = read_line
+ read_line = timestamp_file.readline()
+ timestamp = timestamp.strip('\r\n \t')
+ if timestamp is not None:
+ repozo_formated_command += ' -o "%%s" -D %s' % (timestamp, )
+ result = recover(
+ known_tid_storage_identifier_dict=options.known_tid_storage_identifier_dict,
+ repozo_formated_command=repozo_formated_command,
+ check=options.dry_run)
+ else:
+ repozo_formated_command += ' -f "%s" -m "%s"'
+ result = backup(
+ address=address,
+ known_tid_storage_identifier_dict=options.known_tid_storage_identifier_dict,
+ zope_formated_url=zope_formated_url,
+ repozo_formated_command=repozo_formated_command)
+ if result == 0:
+ # Paranoid mode:
+ # Issue a system-wide "sync" command to make sure all files which were saved
+ # are really present on disk.
+ os.system('sync')
+ timestamp_file = open(options.timestamp_file_path, 'a', 0)
+ try:
+ # Borrowed from repozo.
+ timestamp_file.write('\n%04d-%02d-%02d-%02d-%02d-%02d' % time.gmtime()[:6])
+ finally:
+ timestamp_file.close()
+ return result
+
+if __name__ == '__main__':
+ sys.exit(main())
More information about the Erp5-report
mailing list