summaryrefslogtreecommitdiffstats
path: root/wallace
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2016-04-15 11:17:04 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2016-04-15 11:17:04 +0200
commit19abcc43f18cf1232815d0dd987296a8d0ada13d (patch)
tree9dba39677b36e31cf068389a7b501611767fbdcf /wallace
parent7f7f0dfb814baffa68c1a2cceaedb1752db60b9a (diff)
downloadpykolab-19abcc43f18cf1232815d0dd987296a8d0ada13d.tar.gz
Fix default folder selection for new invitation objects (#5378)
Summary: Fixes #5378. Makes that folders marked as default are prefered over other folders when savin pending invitation objects Reviewers: #pykolab_developers, vanmeeuwen Reviewed By: #pykolab_developers, vanmeeuwen Subscribers: venc Differential Revision: https://git.kolab.org/D132
Diffstat (limited to 'wallace')
-rw-r--r--wallace/module_invitationpolicy.py30
1 files changed, 15 insertions, 15 deletions
diff --git a/wallace/module_invitationpolicy.py b/wallace/module_invitationpolicy.py
index 89b373d..c5d0a4a 100644
--- a/wallace/module_invitationpolicy.py
+++ b/wallace/module_invitationpolicy.py
@@ -675,7 +675,7 @@ def user_dn_from_email_address(email_address):
local_domains = auth.list_domains()
- if not local_domains == None:
+ if local_domains is not None:
local_domains = list(set(local_domains.keys()))
if not email_address.split('@')[1] in local_domains:
@@ -739,7 +739,7 @@ def imap_proxy_auth(user_rec):
global imap
mail_attribute = conf.get('cyrus-sasl', 'result_attribute')
- if mail_attribute == None:
+ if mail_attribute is None:
mail_attribute = 'mail'
mail_attribute = mail_attribute.lower()
@@ -1012,25 +1012,25 @@ def store_object(object, user_rec, targetfolder=None, master=None):
"""
Append the given object to the user's default calendar/tasklist
"""
-
- # find default calendar folder to save object to if no target folder
- # has already been specified.
+
+ # find calendar folder to save object to if not specified
if targetfolder is None:
targetfolders = list_user_folders(user_rec, object.type)
+ oc = object.get_classification()
- if not targetfolders == None and len(targetfolders) > 0:
- targetfolder = targetfolders[0]
-
- if targetfolder is None:
- if user_rec.has_key('_default_folder'):
- targetfolder = user_rec['_default_folder']
- # use *.confidential folder for invitations classified as confidential
- if object.get_classification() == kolabformat.ClassConfidential and user_rec.has_key('_confidential_folder'):
+ # use *.confidential/private folder for confidential/private invitations
+ if oc == kolabformat.ClassConfidential and user_rec.has_key('_confidential_folder'):
targetfolder = user_rec['_confidential_folder']
- elif object.get_classification() == kolabformat.ClassPrivate and user_rec.has_key('_private_folder'):
+ elif oc == kolabformat.ClassPrivate and user_rec.has_key('_private_folder'):
targetfolder = user_rec['_private_folder']
+ # use *.default folder if exists
+ elif user_rec.has_key('_default_folder'):
+ targetfolder = user_rec['_default_folder']
+ # fallback to any existing folder of specified type
+ elif targetfolders is not None and len(targetfolders) > 0:
+ targetfolder = targetfolders[0]
- if targetfolder == None:
+ if targetfolder is None:
log.error(_("Failed to save %s: no target folder found for user %r") % (object.type, user_rec['mail']))
return False