Commit 25d50bb5 authored by Łukasz Nowak's avatar Łukasz Nowak

- method name corresponds its functionality

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@25801 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 49858230
...@@ -493,7 +493,7 @@ class PoliteThreadingTCPServer(SocketServer.ThreadingTCPServer): ...@@ -493,7 +493,7 @@ class PoliteThreadingTCPServer(SocketServer.ThreadingTCPServer):
daemon_threads = True daemon_threads = True
allow_reuse_address = True allow_reuse_address = True
def main(address, port): def server(address, port):
server = PoliteThreadingTCPServer((address, port), TIDServer) server = PoliteThreadingTCPServer((address, port), TIDServer)
try: try:
try: try:
...@@ -703,7 +703,7 @@ if options.fork: ...@@ -703,7 +703,7 @@ if options.fork:
os.close(1) os.close(1)
os.close(2) os.close(2)
sys.stdout = sys.stderr = logfile sys.stdout = sys.stderr = logfile
main(options.address, options.port) server(options.address, options.port)
log('Exiting.') log('Exiting.')
else: else:
pidfile.write(str(pid)) pidfile.write(str(pid))
...@@ -712,5 +712,5 @@ if options.fork: ...@@ -712,5 +712,5 @@ if options.fork:
else: else:
os._exit(0) os._exit(0)
else: else:
main(options.address, options.port) server(options.address, options.port)
...@@ -298,13 +298,14 @@ def parseargs(): ...@@ -298,13 +298,14 @@ def parseargs():
return options return options
options = parseargs() def main():
address = (options.host, options.port) options = parseargs()
zope_formated_url = options.base_url address = (options.host, options.port)
if options.base_url is not None and '%s' not in zope_formated_url: 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, ) 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)) repozo_formated_command = '%s %s -r "%%s"' % (options.repozo_file_name, ' '.join(options.repozo_opts))
if options.recover: if options.recover:
timestamp_file = open(options.timestamp_file_path, 'r') timestamp_file = open(options.timestamp_file_path, 'r')
timestamp = '' timestamp = ''
read_line = ' ' read_line = ' '
...@@ -318,7 +319,7 @@ if options.recover: ...@@ -318,7 +319,7 @@ if options.recover:
known_tid_storage_identifier_dict=options.known_tid_storage_identifier_dict, known_tid_storage_identifier_dict=options.known_tid_storage_identifier_dict,
repozo_formated_command=repozo_formated_command, repozo_formated_command=repozo_formated_command,
check=options.dry_run) check=options.dry_run)
else: else:
repozo_formated_command += ' -f "%s" -m "%s"' repozo_formated_command += ' -f "%s" -m "%s"'
result = backup( result = backup(
address=address, address=address,
...@@ -336,5 +337,7 @@ else: ...@@ -336,5 +337,7 @@ else:
timestamp_file.write('\n%04d-%02d-%02d-%02d-%02d-%02d' % time.gmtime()[:6]) timestamp_file.write('\n%04d-%02d-%02d-%02d-%02d-%02d' % time.gmtime()[:6])
finally: finally:
timestamp_file.close() timestamp_file.close()
return result
sys.exit(result) if __name__ == '__main__':
sys.exit(main())
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