Skip to content

Instantly share code, notes, and snippets.

@jbowes
Created March 30, 2011 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbowes/894799 to your computer and use it in GitHub Desktop.
Save jbowes/894799 to your computer and use it in GitHub Desktop.
def append(self, path, certlist):
try:
cert = self.cls()
cert.read(path)
bogus = cert.bogus()
if bogus:
bogus.insert(0, _('Reason(s):'))
raise Exception('\n - '.join(bogus))
certlist.append(cert)
except Exception, e:
log.exception(e)
log.error(
'File: %s, not loaded\n%s',
path,
e)
@jbowes
Copy link
Author

jbowes commented Mar 30, 2011

12:53 < alikins> what is line 435 in certificate.py doing?
12:53 < alikins> it's raising an Exception in a try block with a except: Exception
12:59 < jbowes> that's what we call the montebello else
12:59 < jbowes> it short-circuits the following call to append
13:00 < jbowes> but since it's using an exception instead of an else, it's faster.
13:00 < jbowes> scales better for the tight loop that append is in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment