本文整理汇总了Python中models.insight.Insight.renderKeyName方法的典型用法代码示例。如果您正苦于以下问题:Python Insight.renderKeyName方法的具体用法?Python Insight.renderKeyName怎么用?Python Insight.renderKeyName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.insight.Insight
的用法示例。
在下文中一共展示了Insight.renderKeyName方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _createInsight
# 需要导入模块: from models.insight import Insight [as 别名]
# 或者: from models.insight.Insight import renderKeyName [as 别名]
def _createInsight(self, data, name, year):
"""
Create Insight object given data, name, and year
"""
return Insight(id=Insight.renderKeyName(year, name),
name=name,
year=year,
data_json=json.dumps(data))
示例2: _render
# 需要导入模块: from models.insight import Insight [as 别名]
# 或者: from models.insight.Insight import renderKeyName [as 别名]
def _render(self):
self.template_values.update({
'valid_years': VALID_YEARS,
})
insights = ndb.get_multi([ndb.Key(Insight, Insight.renderKeyName(0, insight_name)) for insight_name in Insight.INSIGHT_NAMES.values()])
for insight in insights:
if insight:
self.template_values[insight.name] = insight
return jinja2_engine.render('insights.html', self.template_values)
示例3: _render
# 需要导入模块: from models.insight import Insight [as 别名]
# 或者: from models.insight.Insight import renderKeyName [as 别名]
def _render(self):
self.template_values.update({
'valid_years': VALID_YEARS,
})
insights = ndb.get_multi([ndb.Key(Insight, Insight.renderKeyName(0, insight_name)) for insight_name in Insight.INSIGHT_NAMES.values()])
for insight in insights:
if insight:
self.template_values[insight.name] = insight
path = os.path.join(os.path.dirname(__file__), '../templates/insights.html')
return template.render(path, self.template_values)
示例4: _render
# 需要导入模块: from models.insight import Insight [as 别名]
# 或者: from models.insight.Insight import renderKeyName [as 别名]
def _render(self, *args, **kw):
week_events = EventHelper.getWeekEvents()
template_values = {
"events": week_events,
}
insights = ndb.get_multi([ndb.Key(Insight, Insight.renderKeyName(2013, insight_name)) for insight_name in Insight.INSIGHT_NAMES.values()])
for insight in insights:
if insight:
template_values[insight.name] = insight
path = os.path.join(os.path.dirname(__file__), '../templates/index_insights.html')
return template.render(path, template_values)
示例5: _render
# 需要导入模块: from models.insight import Insight [as 别名]
# 或者: from models.insight.Insight import renderKeyName [as 别名]
def _render(self, year):
template_values = {
'valid_years': VALID_YEARS,
'selected_year': year,
}
insights = ndb.get_multi([ndb.Key(Insight, Insight.renderKeyName(year, insight_name)) for insight_name in Insight.INSIGHT_NAMES.values()])
for insight in insights:
if insight:
template_values[insight.name] = insight
path = os.path.join(os.path.dirname(__file__), '../templates/insights_details.html')
return template.render(path, template_values)
示例6: _render
# 需要导入模块: from models.insight import Insight [as 别名]
# 或者: from models.insight.Insight import renderKeyName [as 别名]
def _render(self):
template_values = {
'valid_years': VALID_YEARS,
}
insight_futures = [Insight.get_by_id_async(Insight.renderKeyName(0, insight_name)) for insight_name in Insight.INSIGHT_NAMES.values()]
for insight_future in insight_futures:
insight = insight_future.get_result()
if insight:
template_values[insight.name] = insight
path = os.path.join(os.path.dirname(__file__), '../templates/insights.html')
return template.render(path, template_values)
示例7: _render
# 需要导入模块: from models.insight import Insight [as 别名]
# 或者: from models.insight.Insight import renderKeyName [as 别名]
def _render(self, *args, **kw):
year = datetime.datetime.now().year
event_keys = Event.query(Event.year == year, Event.event_type_enum.IN(EventType.CMP_EVENT_TYPES)).fetch(100, keys_only=True)
events = [event_key.get() for event_key in event_keys]
template_values = {
"events": events,
}
insights = ndb.get_multi([ndb.Key(Insight, Insight.renderKeyName(year, insight_name)) for insight_name in Insight.INSIGHT_NAMES.values()])
for insight in insights:
if insight:
template_values[insight.name] = insight
path = os.path.join(os.path.dirname(__file__), '../templates/index_champs.html')
return template.render(path, template_values)
示例8: _render
# 需要导入模块: from models.insight import Insight [as 别名]
# 或者: from models.insight.Insight import renderKeyName [as 别名]
def _render(self, *args, **kw):
week_events = EventHelper.getWeekEvents()
year = datetime.datetime.now().year
self.template_values.update({
"events": week_events,
"year": year,
})
insights = ndb.get_multi([ndb.Key(Insight, Insight.renderKeyName(year, insight_name)) for insight_name in Insight.INSIGHT_NAMES.values()])
for insight in insights:
if insight:
self.template_values[insight.name] = insight
path = os.path.join(os.path.dirname(__file__), '../templates/index_insights.html')
return template.render(path, self.template_values)
示例9: _render
# 需要导入模块: from models.insight import Insight [as 别名]
# 或者: from models.insight.Insight import renderKeyName [as 别名]
def _render(self, *args, **kw):
week_events = EventHelper.getWeekEvents()
year = datetime.datetime.now().year
special_webcasts = FirebasePusher.get_special_webcasts()
self.template_values.update({
"events": week_events,
"year": year,
"any_webcast_online": any(w.get('status') == 'online' for w in special_webcasts),
"special_webcasts": special_webcasts,
})
insights = ndb.get_multi([ndb.Key(Insight, Insight.renderKeyName(year, insight_name)) for insight_name in Insight.INSIGHT_NAMES.values()])
for insight in insights:
if insight:
self.template_values[insight.name] = insight
path = os.path.join(os.path.dirname(__file__), '../templates/index_insights.html')
return template.render(path, self.template_values)
示例10: _render
# 需要导入模块: from models.insight import Insight [as 别名]
# 或者: from models.insight.Insight import renderKeyName [as 别名]
def _render(self):
self.template_values.update({
'valid_years': VALID_YEARS,
})
insights = ndb.get_multi([ndb.Key(Insight, Insight.renderKeyName(0, insight_name)) for insight_name in Insight.INSIGHT_NAMES.values()])
last_updated = None
for insight in insights:
if insight:
self.template_values[insight.name] = insight
if last_updated is None:
last_updated = insight.updated
else:
last_updated = max(last_updated, insight.updated)
self.template_values['last_updated'] = last_updated
return jinja2_engine.render('insights.html', self.template_values)