OLD | NEW |
1 #!/usr/bin/python2.4 | 1 #!/usr/bin/python |
2 | 2 |
3 import os | 3 import os |
| 4 import re |
4 import subprocess | 5 import subprocess |
5 import sys | 6 import sys |
6 | 7 |
7 print 'content-type: text/xml' | |
8 print '' | |
9 | |
10 try: | 8 try: |
11 » options = {} | 9 options = {} |
12 » query_string = os.environ['QUERY_STRING'].split('&') | 10 query_string = os.environ['QUERY_STRING'].split('&') |
13 » for q in query_string: | 11 for q in query_string: |
14 » opt = q.split('=') | 12 opt = q.split('=') |
15 » options[opt[0]] = opt[1] | 13 options[opt[0]] = opt[1] |
16 | 14 if ('range' not in options or 'url' not in options or |
17 » c = ['svn', 'log', '--xml', '-v', '-r', options['range'], options['url']
] | 15 not (options['url'].startswith('http://src.chromium.org/svn/') or |
18 » sys.stdout.flush() | 16 options['url'].startswith('http://webrtc.googlecode.com/svn/')) or |
19 » subprocess.call(c) | 17 not re.match(r'^(\d+):(\d+)$', options['range'])): |
| 18 print 'Content-Type: text/html' |
| 19 print '' |
| 20 print '' |
| 21 sys.exit(1) |
| 22 c = ['svn', 'log', '--xml', '-v', '-r', options['range'], options['url']] |
| 23 print 'Content-Type: text/xml' |
| 24 print '' |
| 25 sys.stdout.flush() |
| 26 subprocess.call(c) |
20 except Exception, e: | 27 except Exception, e: |
21 » print e | 28 sys.stderr.write(e) |
22 | |
OLD | NEW |