def clean_html(self, ids): entries = Entry.query.filter(Entry.id.in_(ids)).all() app.logger.info(u"Admin Cleaning HTML for Entries: {0}".format(u", ".join(map(str, entries)))) for entry in entries: entry.content = Entry.clean_images(entry.content) entry.summary = Entry.clean_images(entry.summary) entry.title = Entry.clean_title(entry.title) db.session.add(entry) db.session.commit()
def summary(self, item): """ Gets the summary of an item. :param item: Feedparser entry :type item: dict :return: str """ summary = item.get('summary', None) if summary: summary = Entry.clean_images(summary) return summary
def content(self, item): """ Gets the content of the item. If content is None, try using the summary. :param item: deserialized JSON item :type item: dict :return: str """ content = item.get('content', None) if content is None: content = item.get('summary', None) if content: content = Entry.clean_images(content) return content
def content(self, item): """ Gets the content of the item. If content is None, try using the summary. :param item: Feedparser entry :type item: dict :return: str """ if item.get('content') is None: content = item.get('summary', None) else: try: c = item.get('content')[0] content = c.get('value') except: content = None if content: content = Entry.clean_images(content) return content