本文整理汇总了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()
示例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)
示例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))
示例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)
示例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))
示例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))
示例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))