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:44:20 UTC

[incubator-ponymail] branch master updated: Drop medium_original - 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.git


The following commit(s) were added to refs/heads/master by this push:
     new ad5daa7  Drop medium_original - not useful
ad5daa7 is described below

commit ad5daa7cb428fb063e28d32ed13b7d8c4483690f
Author: Sebb <se...@apache.org>
AuthorDate: Thu Sep 3 17:44:10 2020 +0100

    Drop medium_original - not useful
---
 CHANGELOG.md        |  1 -
 tools/generators.py | 38 --------------------------------------
 2 files changed, 39 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index fca1074..218fe8e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,7 +10,6 @@
 - Bug: only 12 months in a year (#508)
 - Bug: wordcloud.js can overwrite document ids (#507)
 - Enh: allow generator to be overridden for testing (#506)
-- Bug: generator.py does not include original medium generator (#505)
 - Enh: move generator selection to generator.py (#504)
 - Bug: parser fails to extract inline attachments (#501)
 - Bug: Google OAuth used with wrong response_type (#500)
diff --git a/tools/generators.py b/tools/generators.py
index 54e39b4..5de6f25 100644
--- a/tools/generators.py
+++ b/tools/generators.py
@@ -99,43 +99,6 @@ def medium(msg, body, lid, _attachments):
     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
-def medium_original(msg, body, lid, _attachments):
-    """
-    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)
-
-    Returns: "<hash>@<lid>" where hash is sha224 of the message items noted above
-    """
-
-    # Use text body
-    xbody = body if type(body) is bytes else body.encode('ascii', 'ignore')
-    # Use List ID
-    xbody += bytes(lid)
-
-    uid_mdate = 0 # mdate for UID generation
-    try:
-        mdate = email.utils.parsedate_tz(msg_metadata.get('date'))
-        uid_mdate = email.utils.mktime_tz(mdate) # Only set if Date header is valid
-    except:
-       pass
-    xbody += bytes(uid_mdate)
-    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,
@@ -245,7 +208,6 @@ def legacy(msg, body, lid, _attachments):
 __GENERATORS={
     'full': full,
     'medium': medium,
-    'medium_original': medium_original,
     'cluster': cluster,
     'legacy': legacy,
 }