(articles, message)
| 29 | |
| 30 | |
| 31 | def convert_to_article_reply(articles, message): |
| 32 | reply = ArticlesReply(message=message) |
| 33 | from blog.templatetags.blog_tags import truncatechars_content |
| 34 | for post in articles: |
| 35 | imgs = re.findall(r'(?:http\:|https\:)?\/\/.*\.(?:png|jpg)', post.body) |
| 36 | imgurl = '' |
| 37 | if imgs: |
| 38 | imgurl = imgs[0] |
| 39 | article = Article( |
| 40 | title=post.title, |
| 41 | description=truncatechars_content(post.body), |
| 42 | img=imgurl, |
| 43 | url=post.get_full_url() |
| 44 | ) |
| 45 | reply.add_article(article) |
| 46 | return reply |
| 47 | |
| 48 | |
| 49 | @robot.filter(re.compile(r"^\?.*")) |
no test coverage detected