This gets rid of the "bare except"s, and I think it's a
little clearer than the previous code. The ValueError will
be tripped if the string doesn't have a : in it, or if the
int coercion fails. Though perhaps in that instance you'd
want to log an error or something...
How about changing that chunk of code to:
SPAMD_HOST = 'localhost' HOST): SPAMASSASSIN_ HOST
SPAMD_ HOST, SPAMD_PORT = string. split(SPAMD_ HOST,
SPAMD_ PORT = int(SPAMD_PORT)
SPAMD_ PORT = None
SPAMD_PORT = None
if hasattr(mm_cfg, 'SPAMASSASSIN_
SPAMD_HOST = mm_cfg.
try:
':', 1)
except ValueError:
if not SPAMD_PORT: SPAMD_PORT = 783
This gets rid of the "bare except"s, and I think it's a
little clearer than the previous code. The ValueError will
be tripped if the string doesn't have a : in it, or if the
int coercion fails. Though perhaps in that instance you'd
want to log an error or something...
Sean