Exemple #1
0
async def get_blog(blog_id):
    blog = await Blog.find(blog_id)
    comments = await Comment.find_all('blog_id=?', [blog_id],
                                      orderBy='created_at DESC')
    for c in comments:
        c.html_content = text2html(c.content)
    blog.html_content = markdown(blog.content)
    return {'__template__': 'blog.html', 'blog': blog, 'comments': comments}
Exemple #2
0
def get_blog(id):
    blog = yield from Blog.find(id)
    comments = yield from Comment.findAll('blog_id=?', [id],
                                          orderBy='created_at desc')
    for c in comments:
        c.html_content = text2html(c.content)
    blog.html_content = markdown2.markdown(blog.content)
    return {'__template__': 'blog.html', 'blog': blog, 'comments': comments}
async def get_blog(id):
    blog = await Blog.find(id)
    comments = await Comment.findAll("blog_id=?", [id],
                                     orderBy="created_at desc")
    for c in comments:
        c.html_content = text2html(c.content)
    blog.html_content = markdown2.markdown(blog.content)
    return {"__template__": "blog.html", "blog": blog, "comments": comments}
def get_blog(id):
    blog = yield from Blog.find(id)
    comments = yield from Comment.findAll('blog_id=?', [id], orderBy='created_at desc')
    for c in comments:
        c.html_content = text2html(c.content)
    blog.html_content = markdown2.markdown(blog.content)
    return {
        '__template__': 'blog.html' ,
        'blog': blog,
        'comments': comments
    }
Exemple #5
0
async def get_blog(id):
    '''
    用户浏览页:日志详情页
    '''
    blog = await Blog.find(id)
    comments = await Comment.findAll('blog_id=?', [id],
                                     orderBy='create_at desc')
    for c in comments:
        c.html_content = text2html(c.content)
    blog.html_content = markdown(blog.content)
    return {'__template__': 'blog.html', 'blog': blog, 'comments': comments}
def get_blog(id):
    blog = yield from find_model(model='blog', id=id)
    comments = yield from find_models(model='comment', where='blog_id=?', args=[id], orderBy='created_at desc')
    for c in comments:
        c.html_content = text2html(c.content)
    blog.html_content = markdown.markdown(blog.content)
    return {
        '__template__': 'blog.html',
        'blog': blog,
        'comments': comments
    }
async def get_blog(id):
    blog = await Blog.find(id)
    commnets = await Comment.findAll('blog_id=?', id, orderBy='created_at desc')
    for c in commnets:
        c.html_content = text2html(c.content)
    blog.html_content = markdown2.markdown(blog.content)
    return {
        '__template__': 'blog.html',
        'blog': blog,
        'commetns': commnets
    }
Exemple #8
0
async def get_blog(*, id):
    print('<get_blog> excute...')
    blog = await Blog.find(id)
    if blog is None:
        raise APIValueError('id', 'couldn\'t find blog')
    comments = await Comment.find_all('blog_id=?', [id], orderBy='created_at desc')
    for c in comments:
        c.html_content = text2html(c.content)
    blog.html_content = markdown2.markdown(blog.content)
    return {
        '__template__': 'blog.html',
        'blog': blog,
        'comments': comments
    }
Exemple #9
0
def get_blog(id):
    #通过id在数据库Blog表中查询对应内容:
    blog = yield from Blog.find(id)
    #通过id在数据库Comment表中查询对应内容:
    comments = yield from Comment.findAll('blog_id=?', [id], orderBy='created_at desc')
    for c in comments:
        #将content值从text格式转换成html格式:
        c.html_content = text2html(c.content)
    blog.html_content = markdown2.markdown(blog.content)
    return {
        '__template__': 'blog.html',
        'blog': blog,
        'comments': comments
    }