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


Python Comment.get_comments方法代码示例

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


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

示例1: stream

# 需要导入模块: from models import Comment [as 别名]
# 或者: from models.Comment import get_comments [as 别名]
def stream(category):
    if category == 'popular' or category == 'recent':
        if category == 'popular':
            mode = 'public'
        else:
            mode = 'full'

        if g.user.is_authenticated():
            g.user = current_user
            minx = (float)(g.user.location.split(",",2)[0])
            miny = (float)(g.user.location.split(",",2)[1])
        else:
            minx = 12.97160
            miny = 77.59456
        maxx = minx+30.0
        maxy = miny+30.0
        params = urllib.urlencode({'set': mode, 'from': 0, 'to': 20, 'minx': minx, 'miny': miny, 'maxx': maxx, 'maxy': maxy, 'size':'medium', 'mapfilter': 'true'})
        result = urllib.urlopen("http://www.panoramio.com/map/get_panoramas.php?%s" % params)
        data = json.loads(result.read())
        for photo in data['photos']:
            comment = Comment.get_comments(Comment, int(photo['photo_id']))
            if len(comment) != 0:
                photo['comments'] = comment
            else:
                photo['comments'] = None

        return render_template('stream.html',
                               user = g.user,
                               data=data,
                               cat=category,
                               activity=g.activity,
                               myActivity=g.my_activity)
    return render_template('404.html')
开发者ID:steady-daddy,项目名称:panSocial,代码行数:35,代码来源:views.py

示例2: get

# 需要导入模块: from models import Comment [as 别名]
# 或者: from models.Comment import get_comments [as 别名]
 def get(self, digits):
     print(digits)
     requested_id = int(digits)
     post = Post.get_by_id(requested_id)
     error = ''
     comments = Comment.get_comments(post)
     print(comments)
     if not post:
         error = 'Requested post not found :('
     if comments:
         self.render("post.html", error=error, post=post, comments=comments)
     else:
         self.render("post.html", error=error, post=post)
开发者ID:jdiii,项目名称:gae_blog,代码行数:15,代码来源:main.py


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