本文整理汇总了Python中models.point.Point.getFullHistory方法的典型用法代码示例。如果您正苦于以下问题:Python Point.getFullHistory方法的具体用法?Python Point.getFullHistory怎么用?Python Point.getFullHistory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.point.Point
的用法示例。
在下文中一共展示了Point.getFullHistory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models.point import Point [as 别名]
# 或者: from models.point.Point import getFullHistory [as 别名]
def get(self):
pointData = Point.getFullHistory(self.request.get('pointUrl'))
template_values = {
'latestPoint': pointData[0]["point"] if pointData else None,
'numPoints': len(pointData) if pointData else 0,
'pointData': pointData,
'user': self.current_user,
'currentArea':self.session.get('currentArea')
}
path = os.path.join(constants.ROOT, 'templates/pointHistory.html')
self.response.headers.add_header('content-type', 'application/json', charset='utf-8')
self.response.out.write(json.dumps(template.render(path, template_values)))
示例2: get
# 需要导入模块: from models.point import Point [as 别名]
# 或者: from models.point.Point import getFullHistory [as 别名]
def get(self):
pointData = Point.getFullHistory(self.request.get('pointUrl'))
template_values = {
'latestPoint': pointData[0]["point"] if pointData else None,
'numPoints': len(pointData) if pointData else 0,
'pointData': pointData,
'user': self.current_user,
'currentArea':self.session.get('currentArea'),
'currentAreaDisplayName':self.session.get('currentAreaDisplayName')
}
self.response.headers["Content-Type"] = 'application/json; charset=utf-8'
json_values = {
'historyHTML': self.template_render('pointHistory.html', template_values)
}
self.response.out.write(json.dumps(json_values))
示例3: cleanMultipleCurrent
# 需要导入模块: from models.point import Point [as 别名]
# 或者: from models.point.Point import getFullHistory [as 别名]
def cleanMultipleCurrent(self, pointURL):
pointData = Point.getFullHistory(pointURL)
lastVersion = 0
message = ''
logging.info(pointData)
if pointData:
# Find the maximum version
for fullPoint in pointData:
point = fullPoint['point']
if point.version > lastVersion:
lastVersion = point.version
message = message + 'Last Version is %d. ' % lastVersion
# Set anything that is not the maximum version to be not current
pointsCleaned = 0
for fullPoint in pointData:
point = fullPoint['point']
if point.version < lastVersion:
logging.info('V %d ' % point.version)
if point.current:
point.current = False
point.put()
pointsCleaned = pointsCleaned + 1
elif point.version == lastVersion:
point.current = True
point.put()
message = message + 'Updated to turn off current on %d versions' % pointsCleaned
else:
message = 'Unable to retrieve history'
template_values = {
'message': message,
'user': self.current_user,
'currentArea':self.session.get('currentArea')
}
self.response.out.write(self.template_render('message.html', template_values))