aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJ08nY2017-06-26 22:12:09 +0200
committerJ08nY2017-06-26 22:12:09 +0200
commitbdb0ec76d9b7b9a7e6956af5fe15d05c4c73ada4 (patch)
treefca178aa7abef2acb4dadf5262711cc8dcd5da55 /src
parente506b790be863e58930aefb7473cd815a967a581 (diff)
downloadmailman-pgp-bdb0ec76d9b7b9a7e6956af5fe15d05c4c73ada4.tar.gz
mailman-pgp-bdb0ec76d9b7b9a7e6956af5fe15d05c4c73ada4.tar.zst
mailman-pgp-bdb0ec76d9b7b9a7e6956af5fe15d05c4c73ada4.zip
Diffstat (limited to 'src')
-rw-r--r--src/mailman_pgp/archivers/local.py1
-rw-r--r--src/mailman_pgp/archivers/remote.py1
-rw-r--r--src/mailman_pgp/model/list.py20
-rw-r--r--src/mailman_pgp/pgp/inline.py2
-rw-r--r--src/mailman_pgp/pgp/mime.py2
-rw-r--r--src/mailman_pgp/pgp/utils.py10
-rw-r--r--src/mailman_pgp/pgp/wrapper.py2
-rw-r--r--src/mailman_pgp/rules/encryption.py8
8 files changed, 40 insertions, 6 deletions
diff --git a/src/mailman_pgp/archivers/local.py b/src/mailman_pgp/archivers/local.py
index ecb8e8f..04d9a22 100644
--- a/src/mailman_pgp/archivers/local.py
+++ b/src/mailman_pgp/archivers/local.py
@@ -28,4 +28,5 @@ from zope.interface import implementer
@public
@implementer(IArchiver)
class LocalArchiver:
+ """Local PGP enabled archiver."""
pass
diff --git a/src/mailman_pgp/archivers/remote.py b/src/mailman_pgp/archivers/remote.py
index 5969d07..3976f55 100644
--- a/src/mailman_pgp/archivers/remote.py
+++ b/src/mailman_pgp/archivers/remote.py
@@ -28,4 +28,5 @@ from zope.interface import implementer
@public
@implementer(IArchiver)
class RemoteArchiver:
+ """Remote PGP-enabled archiver."""
pass
diff --git a/src/mailman_pgp/model/list.py b/src/mailman_pgp/model/list.py
index e1de7cc..8dc1ed8 100644
--- a/src/mailman_pgp/model/list.py
+++ b/src/mailman_pgp/model/list.py
@@ -78,12 +78,22 @@ class PGPMailingList(Base):
@property
def mlist(self):
+ """
+
+ :return:
+ :rtype: mailman.model.mailinglist.MailingList
+ """
if self._mlist is None:
self._mlist = getUtility(IListManager).get_by_list_id(self.list_id)
return self._mlist
@property
def key(self):
+ """
+
+ :return:
+ :rtype: pgpy.PGPKey
+ """
if self._key is None:
# Check the file
if exists(self.key_path) and isfile(self.key_path):
@@ -99,11 +109,21 @@ class PGPMailingList(Base):
@property
def pubkey(self):
+ """
+
+ :return:
+ :rtype: pgpy.PGPKey
+ """
if self.key is None:
return None
return self.key.pubkey
@property
def key_path(self):
+ """
+
+ :return:
+ :rtype: str
+ """
return join(config.pgp.keydir_config['list_keydir'],
self.list_id + '.asc')
diff --git a/src/mailman_pgp/pgp/inline.py b/src/mailman_pgp/pgp/inline.py
index ae731cf..fe5b2c3 100644
--- a/src/mailman_pgp/pgp/inline.py
+++ b/src/mailman_pgp/pgp/inline.py
@@ -153,7 +153,7 @@ class InlineWrapper:
:param key: The key to verify with.
:type key: pgpy.PGPKey
:return: The verified signatures.
- :rtype: pgpy.types.SignatureVerification
+ :rtype: Generator[pgpy.types.SignatureVerification]
"""
for part in walk(self.msg):
if not part.is_multipart() and self._is_signed(part):
diff --git a/src/mailman_pgp/pgp/mime.py b/src/mailman_pgp/pgp/mime.py
index cbbbf6a..22ebd65 100644
--- a/src/mailman_pgp/pgp/mime.py
+++ b/src/mailman_pgp/pgp/mime.py
@@ -135,7 +135,7 @@ class MIMEWrapper:
:param key: The key to verify with.
:type key: pgpy.PGPKey
:return: The verified signature.
- :rtype: pgpy.types.SignatureVerification
+ :rtype: Generator[pgpy.types.SignatureVerification]
"""
clear_text = self.msg.get_payload(0).as_string()
sig_text = self.msg.get_payload(1).get_payload()
diff --git a/src/mailman_pgp/pgp/utils.py b/src/mailman_pgp/pgp/utils.py
index cc0bda0..0946e3f 100644
--- a/src/mailman_pgp/pgp/utils.py
+++ b/src/mailman_pgp/pgp/utils.py
@@ -15,8 +15,18 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
+"""Various pgp and email utilities."""
+
def copy_headers(from_msg, to_msg):
+ """
+ Copy the headers and unixfrom from a message to another one.
+
+ :param from_msg: The source `Message`.
+ :type from_msg: email.message.Message
+ :param to_msg: The destination `Message`.
+ :type to_msg: email.message.Message
+ """
for key, value in from_msg.items():
if key not in to_msg:
to_msg[key] = value
diff --git a/src/mailman_pgp/pgp/wrapper.py b/src/mailman_pgp/pgp/wrapper.py
index 050dd8b..2b18134 100644
--- a/src/mailman_pgp/pgp/wrapper.py
+++ b/src/mailman_pgp/pgp/wrapper.py
@@ -72,7 +72,7 @@ class PGPWrapper():
:param key: The key to verify with.
:type key: pgpy.PGPKey
:return: The verified signature.
- :rtype: pgpy.types.SignatureVerification
+ :rtype: generator of pgpy.types.SignatureVerification
"""
if self.is_mime_signed():
yield from self.mime.verify(key)
diff --git a/src/mailman_pgp/rules/encryption.py b/src/mailman_pgp/rules/encryption.py
index b2deb8d..cabd62c 100644
--- a/src/mailman_pgp/rules/encryption.py
+++ b/src/mailman_pgp/rules/encryption.py
@@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
-""""""
+"""Encryption moderation rule for the pgp-posting-chain."""
from mailman.core.i18n import _
from mailman.interfaces.rules import IRule
@@ -26,10 +26,12 @@ from zope.interface import implementer
@public
@implementer(IRule)
class Encryption:
- """"""
+ """The encryption moderation rule."""
name = 'encryption'
- description = _("""""")
+ description = _(
+ """A rule which jumps to the moderation chain,
+ when the incoming runner instructs it to.""")
record = True
def check(self, mlist, msg, msgdata):