MCPcopy
hub / github.com/liangliangyy/DjangoBlog / convert_to_article_reply

Function convert_to_article_reply

servermanager/robot.py:31–46  ·  view source on GitHub ↗
(articles, message)

Source from the content-addressed store, hash-verified

29
30
31def 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"^\?.*"))

Callers 2

searchFunction · 0.85
recentsFunction · 0.85

Calls 3

truncatechars_contentFunction · 0.90
ArticleClass · 0.85
get_full_urlMethod · 0.45

Tested by

no test coverage detected