def reviw_normalize_text(root, registry):
from lac.views.filter import find_entities
from lac.views.widget import redirect_links
from lac.content.interface import IBaseReview
import html_diff_wrapper
contents = find_entities(interfaces=[IBaseReview])
len_entities = str(len(contents))
for index, review in enumerate(contents):
if getattr(review, 'article', None):
review.article = html_diff_wrapper.normalize_text(
review.article, {redirect_links})
review.reindex()
if index % 1000 == 0:
log.info("**** Commit ****")
transaction.commit()
log.info(str(index) + "/" + len_entities)
log.info('Review text evolved.')
评论列表
文章目录