当前位置: 首页>>代码示例>>Python>>正文


Python Article.get_article_by_id_detail方法代码示例

本文整理汇总了Python中model.Article.get_article_by_id_detail方法的典型用法代码示例。如果您正苦于以下问题:Python Article.get_article_by_id_detail方法的具体用法?Python Article.get_article_by_id_detail怎么用?Python Article.get_article_by_id_detail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model.Article的用法示例。


在下文中一共展示了Article.get_article_by_id_detail方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: wx_get_article_by_id

# 需要导入模块: from model import Article [as 别名]
# 或者: from model.Article import get_article_by_id_detail [as 别名]
    def wx_get_article_by_id(self, post_id):
        k = 'wx_post_%s' % (str(post_id))
        v = getMc(k)
        if v:
            return v

        article = Article.get_article_by_id_detail(post_id)
        if article:
            if MYSQL_TO_KVDB_SUPPORT:
                title = article['slug']
                description = article['description']
                url = article['absolute_url']
            else:
                title = article.slug
                description = article.description
                url = article.absolute_url
            picUrl = WX_DEFAULT_PIC
            count = 1

            articles_msg = {'articles':[]}
            for i in range(0,count):
                article = {
                        'title':title,
                        'description':description,
                        'picUrl':picUrl,
                        'url':url
                    }
                articles_msg['articles'].append(article)
                article = {}
            setMc(k,articles_msg)
            return articles_msg
        return ''
开发者ID:yobin,项目名称:saepy-log,代码行数:34,代码来源:blog.py

示例2: get_response_article_by_id

# 需要导入模块: from model import Article [as 别名]
# 或者: from model.Article import get_article_by_id_detail [as 别名]
	def get_response_article_by_id(self, post_id):
		global PIC_URL
		# 从数据库查询得到若干文章
		article = Article.get_article_by_id_detail(post_id)
		# postId为文章id
		if article:
			title = article.slug
			description = article.description
			picUrl = PIC_URL
			url = article.absolute_url
			count = 1
			# 这里实现相关逻辑,从数据库中获取内容
			
			# 构造图文消息
			articles_msg = {'articles':[]}
			for i in range(0,count):
				article = {
						'title':title,
						'description':description,
						'picUrl':picUrl,
						'url':url
					}
				# 插入文章
				articles_msg['articles'].append(article)
				article = {}
			# 返回文章
			return articles_msg
		else:
			return
开发者ID:bibodeng,项目名称:pyWeiXin_SAElog,代码行数:31,代码来源:blog.py

示例3: get

# 需要导入模块: from model import Article [as 别名]
# 或者: from model.Article import get_article_by_id_detail [as 别名]
    def get(self, id = '', title = ''):
        tmpl = ''
        obj = Article.get_article_by_id_detail(id)
        if not obj:
            self.redirect(BASE_URL)
            return
        #redirect to right title
        try:
            title = unquote(title).decode('utf-8')
        except:
            pass
        if title != obj.slug:
            self.redirect(obj.absolute_url, 301)
            return
        #
        if obj.password and THEME == 'default':
            rp = self.get_cookie("rp%s" % id, '')
            if rp != obj.password:
                tmpl = '_pw'
        elif obj.password and BLOG_PSW_SUPPORT:
            rp = self.get_cookie("rp%s" % id, '')
            print 'rp===%s' % (str(rp))
            if rp != obj.password:
                tmpl = '_pw'

        keyname = 'pv_%s' % (str(id))
        increment(keyname)#yobin 20120701
        self.set_cookie(keyname, '1', path = "/", expires_days =1)
        self.set_header("Last-Modified", obj.last_modified)
        output = self.render('page%s.html'%tmpl, {
            'title': "%s - %s"%(obj.title, getAttr('SITE_TITLE')),
            'keywords':obj.keywords,
            'description':obj.description,
            'obj': obj,
            'cobjs': obj.coms,
            'postdetail': 'postdetail',
            'cats': Category.get_all_cat_name(),
            'tags': Tag.get_hot_tag_name(),
            'archives': Archive.get_all_archive_name(),
            'page': 1,
            'allpage': 10,
            'comments': Comment.get_recent_comments(),
            'links':Link.get_all_links(),
            'isauthor':self.isAuthor(),
            'hits':get_count(keyname),
            'Totalblog':get_count('Totalblog',NUM_SHARDS,0),
            'listtype': '',
        },layout='_layout.html')
        self.write(output)

        if obj.password and BLOG_PSW_SUPPORT:
            return output
        elif obj.password and THEME == 'default':
            return
        else:
            return output
开发者ID:yangzilong1986,项目名称:saepy-log,代码行数:58,代码来源:blog.py

示例4: get

# 需要导入模块: from model import Article [as 别名]
# 或者: from model.Article import get_article_by_id_detail [as 别名]
 def get(self, id = '', title = ''):
     tmpl = ''
     obj = Article.get_article_by_id_detail(id)
     if not obj:
         self.redirect(BASE_URL)
         return
     #redirect to right title
     try:
         title = unquote(title).decode('utf-8')
     except Exception , e:
         print 'PostDetail()',e
开发者ID:yobin,项目名称:saepy-log,代码行数:13,代码来源:blog.py

示例5: get

# 需要导入模块: from model import Article [as 别名]
# 或者: from model.Article import get_article_by_id_detail [as 别名]
 def get(self, id = '', title = ''):
     tmpl = ''
     obj = Article.get_article_by_id_detail(id)
     if not obj:
         self.redirect(BASE_URL)
         return
     #redirect to right title
     try:
         title = unquote(title).decode('utf-8')
     except:
         pass
     if title != obj.slug:
         self.redirect(obj.absolute_url, 301)
         return        
     #
     if obj.password and THEME == 'default':
         rp = self.get_cookie("rp%s" % id, '')
         if rp != obj.password:
             tmpl = '_pw'
     
     self.set_header("Last-Modified", obj.last_modified)
         
     output = self.render('page%s.html'%tmpl, {
         'title': "%s - %s"%(obj.title, SITE_TITLE),
         'keywords':obj.keywords,
         'description':obj.description,
         'obj': obj,
         'cobjs': obj.coms,
         'postdetail': 'postdetail',
         'cats': Category.get_all_cat_name(),
         'tags': Tag.get_hot_tag_name(),
         'page': 1,
         'allpage': 10,
         'comments': Comment.get_recent_comments(),
         'links':Link.get_all_links(),
     },layout='_layout.html')
     self.write(output)
     
     if obj.password and THEME == 'default':
         return
     else:
         return output
开发者ID:bibodeng,项目名称:pyWeiXin_SAElog,代码行数:44,代码来源:blog.py


注:本文中的model.Article.get_article_by_id_detail方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。