From: Pieter Lexis Date: Thu, 2 Feb 2012 16:48:56 +0000 (+0100) Subject: Use get instead of setdefault X-Git-Url: https://git.svenne.dk/?p=public%2Fdnssec-swede-utility.git;a=commitdiff_plain;h=65280a035279c7dfbba2f87ff41f81ea2456bf7f Use get instead of setdefault --- 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: