summaryrefslogtreecommitdiff
path: root/mail/src
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2015-09-22 17:38:48 -0400
committerKali Kaneko <kali@leap.se>2015-09-23 12:00:15 -0400
commited0d9e36ef5f9d6724ef24d7a5f24a28aead3b3a (patch)
tree8a155d6390f9898a7a63606b68ac021bc37ab10a /mail/src
parent5c10f4cb4e6a7e7f50ddd669bf96dfe68b625272 (diff)
[refactor] avoid circular import due to rfc3156
Diffstat (limited to 'mail/src')
-rw-r--r--mail/src/leap/mail/imap/mailbox.py2
-rw-r--r--mail/src/leap/mail/incoming/tests/test_incoming_mail.py2
-rw-r--r--mail/src/leap/mail/mail.py12
-rw-r--r--mail/src/leap/mail/mailbox_indexer.py5
-rw-r--r--mail/src/leap/mail/outgoing/service.py12
-rw-r--r--mail/src/leap/mail/outgoing/tests/test_outgoing.py2
-rw-r--r--mail/src/leap/mail/rfc3156.py (renamed from mail/src/leap/mail/smtp/rfc3156.py)0
-rw-r--r--mail/src/leap/mail/smtp/gateway.py5
8 files changed, 25 insertions, 15 deletions
diff --git a/mail/src/leap/mail/imap/mailbox.py b/mail/src/leap/mail/imap/mailbox.py
index e73994b..c7accbb 100644
--- a/mail/src/leap/mail/imap/mailbox.py
+++ b/mail/src/leap/mail/imap/mailbox.py
@@ -215,11 +215,13 @@ class IMAPMailbox(object):
but in the future will be useful to get absolute UIDs from
message sequence numbers.
+
:param message: the message sequence number.
:type message: int
:rtype: int
:return: the UID of the message.
+
"""
# TODO support relative sequences. The (imap) message should
# receive a sequence number attribute: a deferred is not expected
diff --git a/mail/src/leap/mail/incoming/tests/test_incoming_mail.py b/mail/src/leap/mail/incoming/tests/test_incoming_mail.py
index 964c8fd..6880496 100644
--- a/mail/src/leap/mail/incoming/tests/test_incoming_mail.py
+++ b/mail/src/leap/mail/incoming/tests/test_incoming_mail.py
@@ -36,7 +36,7 @@ from leap.mail.adaptors import soledad_indexes as fields
from leap.mail.constants import INBOX_NAME
from leap.mail.imap.account import IMAPAccount
from leap.mail.incoming.service import IncomingMail
-from leap.mail.smtp.rfc3156 import MultipartEncrypted, PGPEncrypted
+from leap.mail.rfc3156 import MultipartEncrypted, PGPEncrypted
from leap.mail.tests import (
TestCaseWithKeyManager,
ADDRESS,
diff --git a/mail/src/leap/mail/mail.py b/mail/src/leap/mail/mail.py
index fc5abd2..c0e16a6 100644
--- a/mail/src/leap/mail/mail.py
+++ b/mail/src/leap/mail/mail.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# mail.py
-# Copyright (C) 2014 LEAP
+# Copyright (C) 2014,2015 LEAP
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,7 +15,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
-Generic Access to Mail objects: Public LEAP Mail API.
+Generic Access to Mail objects.
+
+This module holds the public LEAP Mail API, which should be viewed as the main
+entry point for message and account manipulation, in a protocol-agnostic way.
+
+In the future, pluggable transports will expose this generic API.
"""
import itertools
import uuid
@@ -148,6 +153,9 @@ class MessagePart(object):
# TODO This class should be better abstracted from the data model.
# TODO support arbitrarily nested multiparts (right now we only support
# the trivial case)
+ """
+ Represents a part of a multipart MIME Message.
+ """
def __init__(self, part_map, cdocs={}, nested=False):
"""
diff --git a/mail/src/leap/mail/mailbox_indexer.py b/mail/src/leap/mail/mailbox_indexer.py
index 08e5f10..c49f808 100644
--- a/mail/src/leap/mail/mailbox_indexer.py
+++ b/mail/src/leap/mail/mailbox_indexer.py
@@ -15,6 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
+.. :py:module::mailbox_indexer
+
Local tables to store the message Unique Identifiers for a given mailbox.
"""
import re
@@ -72,10 +74,11 @@ class MailboxIndexer(object):
These indexes are Message Attributes needed for the IMAP specification (rfc
3501), although they can be useful for other non-imap store
implementations.
+
"""
# The uids are expected to be 32-bits values, but the ROWIDs in sqlite
# are 64-bit values. I *don't* think it really matters for any
- # practical use, but it's good to remmeber we've got that difference going
+ # practical use, but it's good to remember we've got that difference going
# on.
store = None
diff --git a/mail/src/leap/mail/outgoing/service.py b/mail/src/leap/mail/outgoing/service.py
index 3754650..7cc5a24 100644
--- a/mail/src/leap/mail/outgoing/service.py
+++ b/mail/src/leap/mail/outgoing/service.py
@@ -36,12 +36,12 @@ from leap.keymanager.openpgp import OpenPGPKey
from leap.keymanager.errors import KeyNotFound, KeyAddressMismatch
from leap.mail import __version__
from leap.mail.utils import validate_address
-from leap.mail.smtp.rfc3156 import MultipartEncrypted
-from leap.mail.smtp.rfc3156 import MultipartSigned
-from leap.mail.smtp.rfc3156 import encode_base64_rec
-from leap.mail.smtp.rfc3156 import RFC3156CompliantGenerator
-from leap.mail.smtp.rfc3156 import PGPSignature
-from leap.mail.smtp.rfc3156 import PGPEncrypted
+from leap.mail.rfc3156 import MultipartEncrypted
+from leap.mail.rfc3156 import MultipartSigned
+from leap.mail.rfc3156 import encode_base64_rec
+from leap.mail.rfc3156 import RFC3156CompliantGenerator
+from leap.mail.rfc3156 import PGPSignature
+from leap.mail.rfc3156 import PGPEncrypted
# TODO
# [ ] rename this module to something else, service should be the implementor
diff --git a/mail/src/leap/mail/outgoing/tests/test_outgoing.py b/mail/src/leap/mail/outgoing/tests/test_outgoing.py
index 2376da9..5518b33 100644
--- a/mail/src/leap/mail/outgoing/tests/test_outgoing.py
+++ b/mail/src/leap/mail/outgoing/tests/test_outgoing.py
@@ -30,7 +30,7 @@ from twisted.mail.smtp import User
from mock import Mock
from leap.mail.smtp.gateway import SMTPFactory
-from leap.mail.smtp.rfc3156 import RFC3156CompliantGenerator
+from leap.mail.rfc3156 import RFC3156CompliantGenerator
from leap.mail.outgoing.service import OutgoingMail
from leap.mail.tests import (
TestCaseWithKeyManager,
diff --git a/mail/src/leap/mail/smtp/rfc3156.py b/mail/src/leap/mail/rfc3156.py
index 7d7bc0f..7d7bc0f 100644
--- a/mail/src/leap/mail/smtp/rfc3156.py
+++ b/mail/src/leap/mail/rfc3156.py
diff --git a/mail/src/leap/mail/smtp/gateway.py b/mail/src/leap/mail/smtp/gateway.py
index c988367..45560bf 100644
--- a/mail/src/leap/mail/smtp/gateway.py
+++ b/mail/src/leap/mail/smtp/gateway.py
@@ -41,10 +41,7 @@ from leap.common.events import emit_async, catalog
from leap.keymanager.openpgp import OpenPGPKey
from leap.keymanager.errors import KeyNotFound
from leap.mail.utils import validate_address
-
-from leap.mail.smtp.rfc3156 import (
- RFC3156CompliantGenerator,
-)
+from leap.mail.rfc3156 import RFC3156CompliantGenerator
# replace email generator with a RFC 3156 compliant one.
from email import generator