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


Python Stream.query方法代码示例

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


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

示例1: get

# 需要导入模块: from Stream import Stream [as 别名]
# 或者: from Stream.Stream import query [as 别名]
 def get(self):
     current_time = datetime.datetime.now()
     all_streams = Stream.query()
     for stream in all_streams:
         for date in stream.view_queue:
             minback = current_time - datetime.timedelta(hours=1)
             if date < minback:
                 stream.view_queue.remove(date)
                 stream.views = stream.views - 1
         stream.put()
开发者ID:kenleejr92,项目名称:APT_Fall_15,代码行数:12,代码来源:UpdateTrendingHandler.py

示例2: get

# 需要导入模块: from Stream import Stream [as 别名]
# 或者: from Stream.Stream import query [as 别名]
    def get(self):

        #Get the list of streams
        images = {'stream_names': [], 'image_urls': []}
        streams = Stream.query().order(-Stream.date_last_added)
        for stream in streams:
            images['stream_names'].append(stream.name)
            images['image_urls'].append(stream.cover_image)

        image_json = json.dumps(images,indent=4, separators=(',', ': '))
        self.response.write(image_json)
开发者ID:kenleejr92,项目名称:APT_Fall_15,代码行数:13,代码来源:ViewStreamsMobileHandler.py

示例3: get

# 需要导入模块: from Stream import Stream [as 别名]
# 或者: from Stream.Stream import query [as 别名]
    def get(self):
        self.cache('manage')

        JINJA_ENVIRONMENT = jinja2.Environment(
        loader=jinja2.FileSystemLoader('templates'),
        extensions=['jinja2.ext.autoescape'],
        autoescape=True)

        user = users.get_current_user()
        user_id = user.user_id()
        user_email = user.email()

        #Get the list of streams
        my_streams = Stream.query(Stream.owner_id == user_id)
        subscribed_streams = Stream.query(Stream.subscribed_users.IN([user_email]))
        template_values = {
            'my_streams':my_streams,
            'subscribed_streams':subscribed_streams
        }

        template = JINJA_ENVIRONMENT.get_template('ManagementPage.html')
        self.response.write(template.render(template_values))
开发者ID:kenleejr92,项目名称:APT_Fall_15,代码行数:24,代码来源:ManagementHandler.py

示例4: get

# 需要导入模块: from Stream import Stream [as 别名]
# 或者: from Stream.Stream import query [as 别名]
    def get(self):

        user_email = cgi.escape(self.request.get('user_email'))


        #Get the list of streams
        subscribed_streams = Stream.query(Stream.subscribed_users.IN([user_email]))
        images = {'stream_names': [], 'image_urls': [],}
        for stream in subscribed_streams:
            images['stream_names'].append(stream.name)
            images['image_urls'].append(stream.cover_image)

        image_json = json.dumps(images,indent=4, separators=(',', ': '))
        self.response.write(image_json)
开发者ID:kenleejr92,项目名称:APT_Fall_15,代码行数:16,代码来源:SubscribedMobileHandler.py

示例5: get

# 需要导入模块: from Stream import Stream [as 别名]
# 或者: from Stream.Stream import query [as 别名]
    def get(self):
        # self.setup('trending')
        self.cache('trending')
        JINJA_ENVIRONMENT = jinja2.Environment(
        loader=jinja2.FileSystemLoader('templates'),
        extensions=['jinja2.ext.autoescape'],
        autoescape=True)

        #Get the list of streams
        streams = Stream.query().order(-Stream.views)


        template_values = {
            'streams':streams
        }

        template = JINJA_ENVIRONMENT.get_template('TrendingStreamsPage.html')
        self.response.write(template.render(template_values))
开发者ID:kenleejr92,项目名称:APT_Fall_15,代码行数:20,代码来源:TrendingHandler.py

示例6: get

# 需要导入模块: from Stream import Stream [as 别名]
# 或者: from Stream.Stream import query [as 别名]
    def get(self):
        self.cache('view')

        JINJA_ENVIRONMENT = jinja2.Environment(
        loader=jinja2.FileSystemLoader('templates'),
        extensions=['jinja2.ext.autoescape'],
        autoescape=True)

        user = users.get_current_user()
        user_id = user.user_id()

        #Get the list of streams
        my_streams = Stream.query(Stream.owner_id == user_id).order(Stream.timestamp)
        template_values = {
            'my_streams':my_streams,
        }

        template = JINJA_ENVIRONMENT.get_template('ViewAllStreamsPage.html')
        self.response.write(template.render(template_values))
开发者ID:kenleejr92,项目名称:APT_Fall_15,代码行数:21,代码来源:ViewAllHandler.py

示例7: get

# 需要导入模块: from Stream import Stream [as 别名]
# 或者: from Stream.Stream import query [as 别名]
    def get(self):
        JINJA_ENVIRONMENT = jinja2.Environment(
        loader=jinja2.FileSystemLoader('templates'),
        extensions=['jinja2.ext.autoescape'],
        autoescape=True)

        user = users.get_current_user()
        login_url = users.create_login_url('/management')

        if user :
            self.redirect('/management')

        #Get the list of streams
        streams = Stream.query()

        template_values = {
            'login_url':login_url,
        }

        template = JINJA_ENVIRONMENT.get_template('MainPage.html')
        self.response.write(template.render(template_values))
开发者ID:kenleejr92,项目名称:APT_Fall_15,代码行数:23,代码来源:MainPageHandler.py


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