Mercurial > odfcast
comparison mergeclient.py @ 63:3918c3c69485
Add ignore_file_errors option to mergeclient
Mergeclient is the example client implementation for merging pdf documents.
Therefore it should provide the option to ignore pdf file errors
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Wed, 12 Nov 2014 14:04:02 +0100 |
parents | a8c628466a9d |
children | 4645e50539ff |
comparison
equal
deleted
inserted
replaced
62:16352bd395fa | 63:3918c3c69485 |
---|---|
11 usage = "usage: %prog [options] file1 file2 [ file3, ...]" | 11 usage = "usage: %prog [options] file1 file2 [ file3, ...]" |
12 parser = optparse.OptionParser(usage=usage) | 12 parser = optparse.OptionParser(usage=usage) |
13 parser.add_option("-s", "--host", default="localhost") | 13 parser.add_option("-s", "--host", default="localhost") |
14 parser.add_option("-p", "--port", default="5000") | 14 parser.add_option("-p", "--port", default="5000") |
15 parser.add_option("-o", "--out", default="merged.pdf", dest="out") | 15 parser.add_option("-o", "--out", default="merged.pdf", dest="out") |
16 parser.add_option("-i", "--ignore-file-errors", action="store_true", | |
17 default=False, dest="ignorefileerrors") | |
16 (options, args) = parser.parse_args() | 18 (options, args) = parser.parse_args() |
17 | 19 |
18 if len(args) < 2: | 20 if len(args) < 2: |
19 parser.print_usage() | 21 parser.print_usage() |
20 sys.exit(1) | 22 sys.exit(1) |
21 | 23 |
22 service = "merge" | 24 service = "merge" |
23 url = "http://%s:%s/%s/" % (options.host, options.port, service) | 25 url = "http://%s:%s/%s/" % (options.host, options.port, service) |
26 | |
27 if options.ignorefileerrors: | |
28 url += "?ignore_file_errors=1" | |
24 | 29 |
25 files = [] | 30 files = [] |
26 | 31 |
27 for filename in args: | 32 for filename in args: |
28 files.append(('files', open(filename, 'rb'))) | 33 files.append(('files', open(filename, 'rb'))) |