From 0a947fc43bbea1415694a58036e738f1680e3355 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 10 Dec 2012 20:00:35 -0500 Subject: [PATCH] feed: use hashlib.sha1 for fallback IDs in Feed._get_entry_id This fixes what I broke in commit 0fc2ff4465d741823b3dceebcfcf3a98a0081522 Author: W. Trevor King Date: Thu Oct 4 08:33:32 2012 -0400 Cleanup global module configuration. diff --git a/rss2email.py b/rss2email.py index 216c13d..3919bd7 100755 --- a/rss2email.py +++ b/rss2email.py ... -hash = hashlib.md5 ... I've come back with sha1 instead of md5, mostly because that's what Git uses ;). We don't migrate recorded IDs from the old configuration method, so the change from md5 to sha1 shouldn't affect anyone. Signed-off-by: W. Trevor King --- rss2email/feed.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/rss2email/feed.py b/rss2email/feed.py index 30a7667..9b129c8 100644 --- a/rss2email/feed.py +++ b/rss2email/feed.py @@ -28,6 +28,7 @@ import collections as _collections from email.utils import formataddr as _formataddr +import hashlib as _hashlib import re as _re import socket as _socket import time as _time @@ -436,11 +437,14 @@ class Feed (object): content = self._get_entry_content(entry) content_value = content['value'].strip() if content_value: - return hash(content_value.encode('unicode-escape')).hexdigest() + return _hashlib.sha1( + content_value.encode('unicode-escape')).hexdigest() elif getattr(entry, 'link', None): - return hash(entry.link.encode('unicode-escape')).hexdigest() + return _hashlib.sha1( + entry.link.encode('unicode-escape')).hexdigest() elif getattr(entry, 'title', None): - return hash(entry.title.encode('unicode-escape')).hexdigest() + return _hashlib.sha1( + entry.title.encode('unicode-escape')).hexdigest() def _get_entry_title(self, entry): if hasattr(entry, 'title_detail') and entry.title_detail: -- 2.26.2