summaryrefslogtreecommitdiffstats
path: root/wallace/modules.py
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-03-09 11:33:12 +0000
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-03-09 11:33:12 +0000
commit3ee814c43398756b1756628ab8e1f9d09e1acec6 (patch)
treec5f0e0ffcdbd2db5e67c03184f1b43d16a3d0d7d /wallace/modules.py
parenta1d61b59186acf4e148baae656df86556f575b9e (diff)
downloadpykolab-3ee814c43398756b1756628ab8e1f9d09e1acec6.tar.gz
Correct the use of envelope_sender (this is a list??)
Diffstat (limited to 'wallace/modules.py')
-rw-r--r--wallace/modules.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/wallace/modules.py b/wallace/modules.py
index 8223d7c..c523eba 100644
--- a/wallace/modules.py
+++ b/wallace/modules.py
@@ -200,7 +200,7 @@ X-Wallace-Result: REJECT
msg = MIMEMultipart("report")
msg['From'] = "MAILER-DAEMON@%s" % (constants.fqdn)
- msg['To'] = formataddr(envelope_sender)
+ msg['To'] = formataddr(envelope_sender[0])
msg['Date'] = formatdate(localtime=True)
msg['Subject'] = ndr_message_subject
@@ -225,9 +225,10 @@ X-Wallace-Result: REJECT
try:
smtp.sendmail(
"MAILER-DAEMON@%s" % (constants.fqdn),
- [formataddr(envelope_sender)],
+ [formataddr(envelope_sender[0])],
msg.as_string()
)
+
except smtplib.SMTPDataError, errmsg:
# DEFER
pass
@@ -255,12 +256,13 @@ def cb_action_ACCEPT(module, filepath):
try:
smtp.sendmail(
- formataddr(envelope_sender),
+ formataddr(envelope_sender[0]),
COMMASPACE.join(
[formataddr(recipient) for recipient in recipients]
),
message.as_string()
)
+
except smtplib.SMTPDataError, errmsg:
# DEFER
pass
@@ -289,8 +291,16 @@ def register_group(dirname, module):
if filename.startswith('module_') and filename.endswith('.py'):
module_name = filename.replace('.py','')
name = module_name.replace('module_', '')
- #print "exec(\"from %s.%s import __init__ as %s_%s_register\"" % (module,module_name,module,name)
- exec("from %s.%s import __init__ as %s_%s_register" % (module,module_name,module,name))
+ # TODO: Error recovery from incomplete / incorrect modules.
+ exec(
+ "from %s.%s import __init__ as %s_%s_register" % (
+ module,
+ module_name,
+ module,
+ name
+ )
+ )
+
exec("%s_%s_register()" % (module,name))
def register(name, func, group=None, description=None, aliases=[]):