From 77da586a547a244c03b1efa155d95c31b3583c5f Mon Sep 17 00:00:00 2001 From: jo-soft Date: Wed, 17 Dec 2014 19:38:13 +0100 Subject: [PATCH 1/4] changed hashcompat call to hashlib call, see https://code.djangoproject.com/ticket/20475 --- djangofeeds/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/djangofeeds/models.py b/djangofeeds/models.py index cff322c..3f0f384 100644 --- a/djangofeeds/models.py +++ b/djangofeeds/models.py @@ -6,7 +6,7 @@ from django.db import models from django.db.models import signals from django.utils.translation import ugettext_lazy as _ -from django.utils.hashcompat import md5_constructor +import hashlib from djangofeeds import conf from djangofeeds.utils import naturaldate @@ -337,7 +337,7 @@ class Meta: def auto_guid(self): """Automatically generate a new guid from the metadata available.""" - return md5_constructor("|".join(( + return hashlib.md5("|".join(( self.title, self.link, self.author))).hexdigest() def __unicode__(self): From b5a262583dc079094e41688e04e4744b3dc2ecb7 Mon Sep 17 00:00:00 2001 From: jo-soft Date: Fri, 19 Dec 2014 19:58:17 +0100 Subject: [PATCH 2/4] Changed some more deprecated functions on the way to django 1.7 --- djangofeeds/feedutil.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/djangofeeds/feedutil.py b/djangofeeds/feedutil.py index e33225e..e9d4dce 100644 --- a/djangofeeds/feedutil.py +++ b/djangofeeds/feedutil.py @@ -1,3 +1,4 @@ +import hashlib import time import urllib import urllib2 @@ -7,8 +8,7 @@ from base64 import b64encode from datetime import datetime, timedelta -from django.utils.text import truncate_html_words -from django.utils.hashcompat import md5_constructor +from django.utils.text import Truncator from djangofeeds import conf from djangofeeds.optimization import PostContentOptimizer @@ -27,7 +27,7 @@ def format_date(t): def md5sum(text): """Return the md5sum of a text string.""" - return md5_constructor(text).hexdigest() + return hashlib.md5(text).hexdigest() def safe_encode(value): @@ -171,7 +171,8 @@ def build_img(img_dict): img = "" content = img + content try: - content = truncate_html_words(content, conf.DEFAULT_ENTRY_WORD_LIMIT) + truncator = Truncator(text=content) + content =truncator.words(num=conf.DEFAULT_ENTRY_WORD_LIMIT, html=True) except UnicodeDecodeError: content = "" From 55c930e958d5634eb9dd40bab6bf84d0b125b07d Mon Sep 17 00:00:00 2001 From: jo-soft Date: Fri, 19 Dec 2014 20:03:39 +0100 Subject: [PATCH 3/4] fixed typo --- .idea/django-feeds.iml | 8 ++++++++ .idea/encodings.xml | 4 ++++ .idea/misc.xml | 4 ++++ .idea/modules.xml | 8 ++++++++ .idea/scopes/scope_settings.xml | 5 +++++ .idea/vcs.xml | 6 ++++++ 6 files changed, 35 insertions(+) create mode 100644 .idea/django-feeds.iml create mode 100644 .idea/encodings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/scopes/scope_settings.xml create mode 100644 .idea/vcs.xml diff --git a/.idea/django-feeds.iml b/.idea/django-feeds.iml new file mode 100644 index 0000000..d0876a7 --- /dev/null +++ b/.idea/django-feeds.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..d821048 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..56cbe92 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..31b6bc0 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file From 390c4453e3549cdd4e518b100f2d9c985c601a0b Mon Sep 17 00:00:00 2001 From: jo-soft Date: Fri, 19 Dec 2014 20:04:03 +0100 Subject: [PATCH 4/4] fixed typo --- .idea/django-feeds.iml | 8 -------- .idea/encodings.xml | 4 ---- .idea/misc.xml | 4 ---- .idea/modules.xml | 8 -------- .idea/scopes/scope_settings.xml | 5 ----- .idea/vcs.xml | 6 ------ 6 files changed, 35 deletions(-) delete mode 100644 .idea/django-feeds.iml delete mode 100644 .idea/encodings.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/scopes/scope_settings.xml delete mode 100644 .idea/vcs.xml diff --git a/.idea/django-feeds.iml b/.idea/django-feeds.iml deleted file mode 100644 index d0876a7..0000000 --- a/.idea/django-feeds.iml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml deleted file mode 100644 index d821048..0000000 --- a/.idea/encodings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 56cbe92..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 31b6bc0..0000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml deleted file mode 100644 index 922003b..0000000 --- a/.idea/scopes/scope_settings.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file