예제 #1
0
 def _compute_teaser(self):
     for blog_post in self:
         if blog_post.teaser_manual:
             blog_post.teaser = blog_post.teaser_manual
         else:
             content = text_from_html(blog_post.content, True)
             blog_post.teaser = content[:200] + '...'
예제 #2
0
 def filter_page(search, page, all_pages):
     # Search might have matched words in the xml tags and parameters therefore we make
     # sure the terms actually appear inside the text.
     text = '%s %s %s' % (page.name, page.url, text_from_html(
         page.arch))
     pattern = '|'.join(
         [re.escape(search_term) for search_term in search.split()])
     return re.findall('(%s)' %
                       pattern, text, flags=re.I) if pattern else False
예제 #3
0
파일: mixins.py 프로젝트: GSLabIt/odoo
 def _search_render_results(self, fetch_fields, mapping, icon, limit):
     results_data = self.read(fetch_fields)[:limit]
     for result in results_data:
         result['_fa'] = icon
         result['_mapping'] = mapping
     html_fields = [
         config['name'] for config in mapping.values() if config.get('html')
     ]
     if html_fields:
         for result, data in zip(self, results_data):
             for html_field in html_fields:
                 if data[html_field]:
                     text = text_from_html(data[html_field], True)
                     data[html_field] = text
     return results_data