From: Chris Porter Date: Sun, 12 Oct 2014 12:20:31 +0000 (+0100) Subject: CHANSERV: better batcher error handling for expired accounts/accounts with no email. X-Git-Url: https://jfr.im/git/irc/quakenet/newserv.git/commitdiff_plain/40814391c7b017da05d4daa2895093e5099801c7 CHANSERV: better batcher error handling for expired accounts/accounts with no email. --HG-- branch : chanserv-live --- diff --git a/chanserv/batcher/batcher b/chanserv/batcher/batcher index 9606a4bf..04d2eb2b 100755 --- a/chanserv/batcher/batcher +++ b/chanserv/batcher/batcher @@ -40,7 +40,11 @@ def email(userid, emailtype, prevemail): cur.execute("SELECT users.*, code FROM chanserv.users LEFT JOIN chanserv.languages ON language = languageid WHERE id = %d" % userid) unifieddict = {} - for key, value in cur.fetchone().items(): + one = cur.fetchone() + if one is None: + return + + for key, value in one.items(): unifieddict["user.%s" % key] = value for key, value in CONFIG["templateoptions"].items(): @@ -58,7 +62,10 @@ def email(userid, emailtype, prevemail): if not mailto: mailto = "user.email" - print "%s -> %s" % (`subject`, `unifieddict[mailto]`) + if not unifieddict[mailto]: + return + + print "%s -> %s (%d)" % (`subject`, `unifieddict[mailto]`, userid) inject(unifieddict[mailto], subject, template) def main():