From 17c6b1899c7134d323f2585def8efab8ca86e3e8 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Sun, 20 Apr 2014 19:08:12 -0300 Subject: modified the generate_post_snippets to re-parse full html of posts as well --- askbot/management/commands/generate_post_snippets.py | 1 + askbot/utils/html.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/askbot/management/commands/generate_post_snippets.py b/askbot/management/commands/generate_post_snippets.py index 688450bf..b058862b 100644 --- a/askbot/management/commands/generate_post_snippets.py +++ b/askbot/management/commands/generate_post_snippets.py @@ -13,6 +13,7 @@ class Command(NoArgsCommand): for post in ProgressBar(posts.iterator(), count, message): if hasattr(post, 'summary'): post.summary = post.get_snippet() + post.html = post.parse_post_text()['html'] post.save() transaction.commit() transaction.commit() diff --git a/askbot/utils/html.py b/askbot/utils/html.py index a9b489f4..3aa793f4 100644 --- a/askbot/utils/html.py +++ b/askbot/utils/html.py @@ -75,7 +75,7 @@ def format_url_replacement(url, text): return '%s (%s)' % (url, text) return url or text or '' -def urlize_html(html): +def urlize_html(html, trim_url_limit=40): """will urlize html, while ignoring link patterns inside anchors,
 and  tags
     """
@@ -89,7 +89,7 @@ def urlize_html(html):
 
         #bs4 is weird, so we work around to replace nodes
         #maybe there is a better way though
-        urlized_text = urlize(node, trim_url_limit=40)
+        urlized_text = urlize(node, trim_url_limit=trim_url_limit)
         if unicode(node) == urlized_text:
             continue
 
-- 
cgit v1.2.3-1-g7c22