Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relax assertion for send operations #100

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions exchangelib/items.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,7 @@ def _create(self, message_disposition, send_meeting_invitations):
items=[self], folder=self.folder, message_disposition=message_disposition,
send_meeting_invitations=send_meeting_invitations)
if message_disposition in (SEND_ONLY, SEND_AND_SAVE_COPY):
if res:
raise ValueError('Got a response in non-save mode')
return None
return res or None
if len(res) != 1:
raise ValueError('Expected result length 1, but got %s' % res)
if isinstance(res[0], Exception):
Expand Down Expand Up @@ -339,9 +337,7 @@ def _update(self, update_fieldnames, message_disposition, conflict_resolution, s
conflict_resolution=conflict_resolution,
send_meeting_invitations_or_cancellations=send_meeting_invitations)
if message_disposition == SEND_AND_SAVE_COPY:
if res:
raise ValueError('Got a response in non-save mode')
return None
return res or None
if len(res) != 1:
raise ValueError('Expected result length 1, but got %s' % res)
if isinstance(res[0], Exception):
Expand Down Expand Up @@ -713,10 +709,7 @@ def send(self, save_copy=True, copy_to_folder=None, conflict_resolution=AUTO_RES
send_meeting_invitations=send_meeting_invitations)
return None

res = self._create(message_disposition=SEND_ONLY, send_meeting_invitations=send_meeting_invitations)
if res:
raise ValueError('Unexpected response in send-only mode')
return None
return self._create(message_disposition=SEND_ONLY, send_meeting_invitations=send_meeting_invitations) or None

def send_and_save(self, update_fields=None, conflict_resolution=AUTO_RESOLVE,
send_meeting_invitations=SEND_TO_NONE):
Expand All @@ -737,12 +730,10 @@ def send_and_save(self, update_fields=None, conflict_resolution=AUTO_RESOLVE,
self.send(save_copy=False, conflict_resolution=conflict_resolution,
send_meeting_invitations=send_meeting_invitations)
else:
res = self._create(
return self._create(
message_disposition=SEND_AND_SAVE_COPY,
send_meeting_invitations=send_meeting_invitations
)
if res:
raise ValueError('Unexpected response in send-only mode')
) or None

def reply(self, subject, body, to_recipients=None, cc_recipients=None, bcc_recipients=None):
if not self.account:
Expand Down