summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-07-04 14:37:50 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2011-07-04 14:37:50 +0100
commitca6a5430187c09e2c000caadc701a2db96a0d7c7 (patch)
treed71f5cb989bfd0074074f877cd7656b9300da50a
parent2b483d09d7301d35c92e5f87b5032d4d513bc44e (diff)
downloadpykolab-ca6a5430187c09e2c000caadc701a2db96a0d7c7.tar.gz
Make sure all the secondary recipient policies are executed
-rw-r--r--pykolab/plugins/recipientpolicy/__init__.py22
1 files changed, 18 insertions, 4 deletions
diff --git a/pykolab/plugins/recipientpolicy/__init__.py b/pykolab/plugins/recipientpolicy/__init__.py
index 2baaaf7..18aa064 100644
--- a/pykolab/plugins/recipientpolicy/__init__.py
+++ b/pykolab/plugins/recipientpolicy/__init__.py
@@ -94,15 +94,29 @@ class KolabRecipientpolicy(object):
alternative_mail = []
- for routine in alternative_mail_routines.keys():
- for _domain in [ kw['primary_domain'] ] + kw['secondary_domains']:
- user_attrs['domain'] = _domain
+ #print "%r" %(alternative_mail_routines)
+ _domains = [ kw['primary_domain'] ] + kw['secondary_domains']
+
+ for number in alternative_mail_routines.keys():
+ for routine in alternative_mail_routines[number].keys():
try:
- exec("retval = '%s'.%s" % (routine,alternative_mail_routines[routine] % user_attrs))
+ exec("retval = '%s'.%s" % (routine,alternative_mail_routines[number][routine] % user_attrs))
except KeyError, e:
log.warning(_("Attribute substitution for 'alternative_mail' failed in Recipient Policy"))
+
+ #log.debug(_("Appending additional mail address: %s") %(retval), level=8)
alternative_mail.append(retval)
+ for _domain in kw['secondary_domains']:
+ user_attrs['domain'] = _domain
+ try:
+ exec("retval = '%s'.%s" % (routine,alternative_mail_routines[number][routine] % user_attrs))
+ except KeyError, e:
+ log.warning(_("Attribute substitution for 'alternative_mail' failed in Recipient Policy"))
+
+ #log.debug(_("Appending additional mail address: %s") %(retval), level=8)
+ alternative_mail.append(retval)
+
alternative_mail = utils.normalize(alternative_mail)
alternative_mail = list(set(alternative_mail))