def main(rfc_number, trans_mode=None): print('RFC %d:' % rfc_number) try: fetch_rfc(rfc_number) except RFCNotFound as e: print('Exception: RFCNotFound!') filename = "html/rfc%d-not-found.html" % rfc_number with open(filename, "w") as f: f.write('') return except Exception as e: print(e) filename = "html/rfc%d-error.html" % rfc_number with open(filename, "w") as f: f.write('') return res = trans_rfc(rfc_number, mode=trans_mode) if res is False: return False make_html(rfc_number)
parser.add_argument('--transtest', action='store_true') parser.add_argument('--force', '-f', action='store_true') args = parser.parse_args() if args.make_index: make_index() elif args.transtest: from src.trans_rfc import trans_test trans_test() elif args.fetch and args.begin and args.end: numbers = list(diff_remote_and_local_index()) numbers = [x for x in numbers if args.begin <= x <= args.end] for rfc_number in numbers: fetch_rfc(rfc_number) elif args.fetch and args.rfc: fetch_rfc(args.rfc, args.force) elif args.trans and args.rfc: trans_rfc(args.rfc, mode=args.trans_mode) elif args.make and args.begin and args.end: for rfc_number in range(args.begin, args.end): make_html(rfc_number) elif args.make and args.rfc: make_html(args.rfc) elif args.rfc: main(args.rfc, trans_mode=args.trans_mode) else: continuous_main(begin=args.begin, end=args.end,