Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions djangofeeds/feedutil.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import hashlib
import time
import urllib
import urllib2
Expand All @@ -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
Expand All @@ -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):
Expand Down Expand Up @@ -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 = ""

Expand Down
4 changes: 2 additions & 2 deletions djangofeeds/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down