本文整理汇总了Python中db.Database.getNode方法的典型用法代码示例。如果您正苦于以下问题:Python Database.getNode方法的具体用法?Python Database.getNode怎么用?Python Database.getNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类db.Database
的用法示例。
在下文中一共展示了Database.getNode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GET
# 需要导入模块: from db import Database [as 别名]
# 或者: from db.Database import getNode [as 别名]
def GET(self):
dbase=Database()
pt = Paths(dbase)
user_data = web.input(node1="b-E3",node2="b-E3")
pth=[]
for el in pt.getPath(user_data["node1"],user_data["node2"]):
node=dbase.getNode(el)
pth.append({"id":node.id,"lat":node.x,"lon":node.y,"name":node.name})
web.header("Content-Type","application/json")
return json.dumps(pth)
示例2: GET
# 需要导入模块: from db import Database [as 别名]
# 或者: from db.Database import getNode [as 别名]
def GET(self):
dbase=Database()
ath=Auth(dbase)
if not ath.checkAuth():
raise web.seeother('/login')
tkn,new=dbase.user_exists(ath.getUserid())
if new == True:
raise web.seeother("/onboard")
user_data = web.input(node="2016012246")
nd1=user_data.node
pt = Paths(dbase)
env = Environment(loader=PackageLoader('html', ''))
template = env.get_template('maptest.html')
classes=dbase.getDayClasses(ath.getUserid())
for cls in classes:
x=classes.index(cls)
if x ==0:
classes[x].lastClassLoc="b-E3"
else:
classes[x].lastClassLoc=classes[x-1].build
classes[x].class_name=classes[x].class_name.split(" - ")[0]
classes[x].build="b-"+cls.where.split(" ")[0]
classes[x].timestamp=classes[x].timestamp.strftime("%I:%M %p")
classes[x].timeend=classes[x].timeend.strftime("%I:%M %p")
if cls.type=="LEC":
classes[x].col="warning"
elif cls.type=="TST":
classes[x].col="danger"
elif cls.type=="TUT":
classes[x].col="info"
elif cls.type=="LAB":
classes[x].col="success"
elif cls.type=="SEM":
classes[x].col="warning"
xs=[]
pth=[]
for el in pt.getPath(nd1,"b-E3"):
node=dbase.getNode(el)
pth.append([node.x,node.y])
xs.append(node)
return template.render(vertices=xs,path=pth,classes=classes,qr_data=ath.getUserid()+":"+ath.getUserToken())