You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2020/09/03 16:46:40 UTC
[incubator-ponymail-foal] branch master updated: Not useful
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
The following commit(s) were added to refs/heads/master by this push:
new e492fcc Not useful
e492fcc is described below
commit e492fccbae63aab7b322ff1c482cd3d73613d314
Author: Sebb <se...@apache.org>
AuthorDate: Thu Sep 3 17:46:26 2020 +0100
Not useful
---
tools/plugins/generators.py | 42 ------------------------------------------
1 file changed, 42 deletions(-)
diff --git a/tools/plugins/generators.py b/tools/plugins/generators.py
index 2d68118..820ae26 100644
--- a/tools/plugins/generators.py
+++ b/tools/plugins/generators.py
@@ -226,47 +226,6 @@ def medium(msg, body, lid, _attachments, _raw_msg):
mid = "%s@%s" % (hashlib.sha224(xbody).hexdigest(), lid)
return mid
-
-# Original medium generator used for a while in June 2016
-# Committed: https://gitbox.apache.org/repos/asf?p=incubator-ponymail.git;a=commitdiff;h=aa989610
-# Replaced: https://gitbox.apache.org/repos/asf?p=incubator-ponymail.git;a=commitdiff;h=4732d25f
-# Currently broken, as it expects a bytestring but gets a string as body (DO NOT USE)
-def medium_original(msg, body, lid, _attachments, _raw_msg):
- """
- NOT RECOMMENDED - does not generate sufficiently unique ids
- Also the lid is included in the hash; this causes problems if the listname needs to be changed.
-
- The following message fields are concatenated to form the hash input:
- - body: if bytes as is else encoded ascii, ignoring invalid characters; if the body is null an Exception is thrown
- - lid
- - Date header if it exists and parses OK; converted to UTC seconds since the epoch; else 0
-
- Parameters:
- msg - the parsed message (used to get the date)
- body - the parsed text content (may be null)
- lid - list id
- _attachments - list of attachments (not used)
- _raw_msg - the original message bytes (not used)
-
- Returns: "<hash>@<lid>" where hash is sha224 of the message items noted above
- """
-
- # Use text body
- xbody = body.encode('utf-8', 'ignore')
- # Use List ID
- xbody += lid # WRONG: Should be: bytes(lid, 'ascii')
-
- uid_mdate = 0 # mdate for UID generation
- try:
- mdate = email.utils.parsedate_tz(msg.get('date'))
- uid_mdate = email.utils.mktime_tz(mdate) # Only set if Date header is valid
- except:
- pass
- xbody += bytes(str(uid_mdate), 'ascii')
- mid = "%s@%s" % (hashlib.sha224(xbody).hexdigest(), lid)
- return mid
-
-
# cluster: Use data that is guaranteed to be the same across cluster setups
# This is the recommended generator for cluster setups.
# Unlike 'medium', this only makes use of the Date: header and not the archived-at,
@@ -380,7 +339,6 @@ __GENERATORS = {
'dkim': dkim,
'full': full,
'medium': medium,
- 'medium_original': medium_original,
'cluster': cluster,
'legacy': legacy,
}