summaryrefslogtreecommitdiff
path: root/src/leap
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
commitfcdc227c23e6958aab902c95aeab35285c9993f0 (patch)
tree30b8e0f597267e828a98db971dff570ad54daf2e /src/leap
parent309578890ba5d188f3d569473d756c28e06aa7ab (diff)
[refactor] avoid circular import due to rfc3156
Diffstat (limited to 'src/leap')
-rw-r--r--src/leap/mail/imap/mailbox.py2
-rw-r--r--src/leap/mail/incoming/tests/test_incoming_mail.py2
-rw-r--r--src/leap/mail/mail.py12
-rw-r--r--src/leap/mail/mailbox_indexer.py5
-rw-r--r--src/leap/mail/outgoing/service.py12
-rw-r--r--src/leap/mail/outgoing/tests/test_outgoing.py2
-rw-r--r--src/leap/mail/rfc3156.py (renamed from src/leap/mail/smtp/rfc3156.py)0
-rw-r--r--src/leap/mail/smtp/gateway.py5
8 files changed, 25 insertions, 15 deletions
diff --git a/src/leap/mail/imap/mailbox.py b/src/leap/mail/imap/mailbox.py
index e73994b..c7accbb 100644
--- a/src/leap/mail/imap/mailbox.py
+++ b/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/src/leap/mail/incoming/tests/test_incoming_mail.py b/src/leap/mail/incoming/tests/test_incoming_mail.py
index 964c8fd..6880496 100644
--- a/src/leap/mail/incoming/tests/test_incoming_mail.py
+++ b/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/src/leap/mail/mail.py b/src/leap/mail/mail.py
index fc5abd2..c0e16a6 100644
--- a/src/leap/mail/mail.py
+++ b/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/src/leap/mail/mailbox_indexer.py b/src/leap/mail/mailbox_indexer.py
index 08e5f10..c49f808 100644
--- a/src/leap/mail/mailbox_indexer.py
+++ b/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/src/leap/mail/outgoing/service.py b/src/leap/mail/outgoing/service.py
index 3754650..7cc5a24 100644
--- a/src/leap/mail/outgoing/service.py
+++ b/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/src/leap/mail/outgoing/tests/test_outgoing.py b/src/leap/mail/outgoing/tests/test_outgoing.py
index 2376da9..5518b33 100644
--- a/src/leap/mail/outgoing/tests/test_outgoing.py
+++ b/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/src/leap/mail/smtp/rfc3156.py b/src/leap/mail/rfc3156.py
index 7d7bc0f..7d7bc0f 100644
--- a/src/leap/mail/smtp/rfc3156.py
+++ b/src/leap/mail/rfc3156.py
diff --git a/src/leap/mail/smtp/gateway.py b/src/leap/mail/smtp/gateway.py
index c988367..45560bf 100644
--- a/src/leap/mail/smtp/gateway.py
+++ b/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