Commit 38e7f631 authored by Łukasz Nowak's avatar Łukasz Nowak

- accept arguments in main method to make it easier to use it as entry point,...

 - accept arguments in main method to make it easier to use it as entry point, and merge properly passed arguments with passed from command line

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42739 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0b7ccfaa
......@@ -585,7 +585,15 @@ def usage(stream, msg=None):
program = os.path.basename(sys.argv[0])
print >>stream, __doc__ % {"program": program}
def main():
def main(argument_list=None):
if argument_list is None:
argument_list = []
# as this method can be used as entry point extend real sys.argv with
# passed argument list
old_argv = sys.argv[:]
sys.argv = [old_argv[0]]
sys.argv.extend(argument_list)
sys.argv.extend(old_argv[1:])
try:
opts, args = getopt.getopt(sys.argv[1:],
"hpvD", ["help", "verbose", "profile", "portal_id=", "data_fs_path=",
......
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