Rename instances of the IMAP server variable
Renamed from mailbox to server for clarity. Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
@@ -38,6 +38,8 @@
|
|||||||
- Add savesettings command.
|
- Add savesettings command.
|
||||||
- Add extra logging to the IMAP email source. GitLab issue #682.
|
- Add extra logging to the IMAP email source. GitLab issue #682.
|
||||||
Thanks to Patrick Hütter (@PatrickHuetter) for the report.
|
Thanks to Patrick Hütter (@PatrickHuetter) for the report.
|
||||||
|
- Rename all instances of the IMAP server from mailbox to
|
||||||
|
server for clarity.
|
||||||
|
|
||||||
3.2.8 (2019-10-01)
|
3.2.8 (2019-10-01)
|
||||||
==================
|
==================
|
||||||
|
|||||||
@@ -234,13 +234,13 @@ class IMAPEmail(EmailBaseModel):
|
|||||||
logger.debug('ssl: %s', self.ssl)
|
logger.debug('ssl: %s', self.ssl)
|
||||||
|
|
||||||
if self.ssl:
|
if self.ssl:
|
||||||
mailbox = imaplib.IMAP4_SSL(host=self.host, port=self.port)
|
server = imaplib.IMAP4_SSL(host=self.host, port=self.port)
|
||||||
else:
|
else:
|
||||||
mailbox = imaplib.IMAP4(host=self.host, port=self.port)
|
server = imaplib.IMAP4(host=self.host, port=self.port)
|
||||||
|
|
||||||
mailbox.login(user=self.username, password=self.password)
|
server.login(user=self.username, password=self.password)
|
||||||
try:
|
try:
|
||||||
mailbox.select(mailbox=self.mailbox)
|
server.select(mailbox=self.mailbox)
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
raise SourceException(
|
raise SourceException(
|
||||||
'Error selecting mailbox: {}; {}'.format(
|
'Error selecting mailbox: {}; {}'.format(
|
||||||
@@ -249,7 +249,7 @@ class IMAPEmail(EmailBaseModel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
status, data = mailbox.search(None, 'NOT', 'DELETED')
|
status, data = server.search(None, 'NOT', 'DELETED')
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
raise SourceException(
|
raise SourceException(
|
||||||
'Error executing search command; {}'.format(exception)
|
'Error executing search command; {}'.format(exception)
|
||||||
@@ -261,7 +261,7 @@ class IMAPEmail(EmailBaseModel):
|
|||||||
|
|
||||||
for message_number in messages_info:
|
for message_number in messages_info:
|
||||||
logger.debug('message_number: %s', message_number)
|
logger.debug('message_number: %s', message_number)
|
||||||
status, data = mailbox.fetch(
|
status, data = server.fetch(
|
||||||
message_set=message_number, message_parts='(RFC822)'
|
message_set=message_number, message_parts='(RFC822)'
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
@@ -277,7 +277,7 @@ class IMAPEmail(EmailBaseModel):
|
|||||||
|
|
||||||
if not test:
|
if not test:
|
||||||
try:
|
try:
|
||||||
mailbox.store(
|
server.store(
|
||||||
message_set=message_number, command='+FLAGS',
|
message_set=message_number, command='+FLAGS',
|
||||||
flags=r'\Deleted'
|
flags=r'\Deleted'
|
||||||
)
|
)
|
||||||
@@ -289,9 +289,9 @@ class IMAPEmail(EmailBaseModel):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
mailbox.expunge()
|
server.expunge()
|
||||||
mailbox.close()
|
server.close()
|
||||||
mailbox.logout()
|
server.logout()
|
||||||
|
|
||||||
|
|
||||||
class POP3Email(EmailBaseModel):
|
class POP3Email(EmailBaseModel):
|
||||||
|
|||||||
Reference in New Issue
Block a user