Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: modules/adblockplus/files/mimeo.py

Issue 29504594: #2687 - Include mimeo python module (Closed)
Left Patch Set: For comment 41 Created Aug. 21, 2017, 7:54 p.m.
Right Patch Set: For comments 47 and 48 Created Aug. 22, 2017, 8:33 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « hiera/roles/web/adblockbrowser.yaml ('k') | modules/adblockplus/manifests/web/mimeo.pp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 #!/usr/bin/env python3 1 #!/usr/bin/env python3
2 2
3 import argparse 3 import argparse
4 import re 4 import re
5 import sys 5 import sys
6 import threading 6 import threading
7 import traceback 7 import traceback
8 8
9 from http.server import BaseHTTPRequestHandler, HTTPServer 9 from http.server import BaseHTTPRequestHandler, HTTPServer
10 from string import Template 10 from string import Template
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 parser.add_argument('--response', action='store', 65 parser.add_argument('--response', action='store',
66 type=str, nargs='?', default='OK', 66 type=str, nargs='?', default='OK',
67 help='The response send to the client') 67 help='The response send to the client')
68 parser.add_argument('--format', action='store', 68 parser.add_argument('--format', action='store',
69 type=str, nargs='?', 69 type=str, nargs='?',
70 default=DEFAULT_LOG, 70 default=DEFAULT_LOG,
71 help='Format of the log ouput') 71 help='Format of the log ouput')
72 parser.add_argument('output', action='store', 72 parser.add_argument('output', action='store',
73 type=str, nargs='?', default='-', 73 type=str, nargs='?', default='-',
74 help='The file where the logs will be written') 74 help='The file where the logs will be written')
75 args = parser.parse_args()
76 if args.output and args.output != '-':
77 fh = open(args.output, 'a')
78 else:
79 fh = open(sys.stdout.fileno(), 'w', closefd=False)
75 try: 80 try:
mathias 2017/08/21 20:07:38 The `try` block should not start before `fh` is de
f.lopez 2017/08/22 16:52:42 Done.
76 args = parser.parse_args()
77 if args.output and args.output != '-':
78 fh = open(args.output, 'a')
79 else:
80 fh = open(sys.stdout.fileno(), 'w', closefd=False)
81 Handler.output = fh 81 Handler.output = fh
82 Handler.format = args.format 82 Handler.format = args.format
83 Handler.response = args.response 83 Handler.response = args.response
84 server_address = ('', args.port) 84 server_address = ('', args.port)
85 httpd = HTTPServer(server_address, Handler) 85 httpd = HTTPServer(server_address, Handler)
86 httpd.serve_forever() 86 httpd.serve_forever()
87 finally: 87 finally:
88 fh.close() 88 fh.close()
LEFTRIGHT

Powered by Google App Engine
This is Rietveld