From 65280a035279c7dfbba2f87ff41f81ea2456bf7f Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Thu, 2 Feb 2012 17:48:56 +0100 Subject: [PATCH] Use get instead of setdefault --- swede | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/swede b/swede index d7a6041..ee5eaf3 100755 --- a/swede +++ b/swede @@ -415,9 +415,9 @@ if __name__ == '__main__': # First, check if the first three fields have correct values. if not args.quiet: print 'Received the following record for name %s:' % record.name - print '\tUsage:\t\t\t\t%d (%s)' % (record.usage, {0:'CA Constraint', 1:'End-Entity Constraint', 2:'Trust Anchor'}.setdefault(record.usage, 'INVALID')) - print '\tSelector:\t\t\t%d (%s)' % (record.selector, {0:'Certificate', 1:'SubjectPublicKeyInfo'}.setdefault(record.usage, 'INVALID')) - print '\tMatching Type:\t\t\t%d (%s)' % (record.mtype, {0:'Full Certificate', 1:'SHA-256', 2:'SHA-512'}.setdefault(record.usage, 'INVALID')) + print '\tUsage:\t\t\t\t%d (%s)' % (record.usage, {0:'CA Constraint', 1:'End-Entity Constraint', 2:'Trust Anchor'}.get(record.usage, 'INVALID')) + print '\tSelector:\t\t\t%d (%s)' % (record.selector, {0:'Certificate', 1:'SubjectPublicKeyInfo'}.get(record.usage, 'INVALID')) + print '\tMatching Type:\t\t\t%d (%s)' % (record.mtype, {0:'Full Certificate', 1:'SHA-256', 2:'SHA-512'}.get(record.usage, 'INVALID')) print '\tCertificate for Association:\t%s' % record.cert try: -- 2.36.1