projects
/
pygrader.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f7a7a47
)
handler: add InvalidMessage.message_id convenience method.
author
W. Trevor King
<wking@tremily.us>
Sun, 2 Sep 2012 12:32:12 +0000
(08:32 -0400)
committer
W. Trevor King
<wking@tremily.us>
Sun, 2 Sep 2012 12:32:12 +0000
(08:32 -0400)
pygrader/handler/__init__.py
patch
|
blob
|
history
diff --git
a/pygrader/handler/__init__.py
b/pygrader/handler/__init__.py
index 1837721320975337701c6657d1d376409c855196..3fb7b28aa8ca36963f142b2740bbff99f8da511a 100644
(file)
--- a/
pygrader/handler/__init__.py
+++ b/
pygrader/handler/__init__.py
@@
-11,6
+11,19
@@
class InvalidMessage (ValueError):
self.message = message
self.error = error
+ def message_id(self):
+ """Return a short string identifying the invalid message.
+ """
+ if self.message is None:
+ return None
+ subject = self.message['Subject']
+ if subject is not None:
+ return repr(subject)
+ message_id = self.message['Message-ID']
+ if message_id is not None:
+ return message_id
+ return None
+
class UnsignedMessage (InvalidMessage):
def __init__(self, **kwargs):