本文整理汇总了Python中Map.Map.query方法的典型用法代码示例。如果您正苦于以下问题:Python Map.query方法的具体用法?Python Map.query怎么用?Python Map.query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Map.Map
的用法示例。
在下文中一共展示了Map.query方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: apiSearch
# 需要导入模块: from Map import Map [as 别名]
# 或者: from Map.Map import query [as 别名]
def apiSearch():
queryType = request.args.get("query_type","")
query = request.args.get("query","")
maps = []
mapsResult = []
resp = []
result = {}
result["result_type"] = "map"
if queryType == "" or query == "":
return json_response(code=400)
if queryType == "mapName" or queryType == "location" or queryType == "keyword":
if queryType == "mapName":
mapQuery = Map.query(Map.public == True)
for map in mapQuery:
if(query.lower() == map.name.lower()):
mapsResult.append(map.to_dict())
result["result"] = mapsResult
resp.append(result)
return json_success(resp)
示例2: search
# 需要导入模块: from Map import Map [as 别名]
# 或者: from Map.Map import query [as 别名]
def search():
if request.method == 'GET':
maps = []
mapIds = []
queryType=request.args.get("queryType","")
query = request.args.get("query","")
uid = session['userId']
account = Account.get_by_id(uid)
logging.info("searching for " + queryType + " " + query)
mapQuery = Map.query(Map.public == True)
for map in mapQuery:
if queryType == 'searchMaps':
if(query.lower() == map.name.lower()):
logging.info("match!")
maps.append(map)
mapIds.append(map.key.integer_id())
for mapId in account.adminMaps:
m = Map.get_by_id(mapId)
if (query.lower() == m.name.lower()):
if mapId not in mapIds:
maps.append(m)
logging.info(len(maps))
return render_template('search.html',maps=maps)
示例3: getUserMaps
# 需要导入模块: from Map import Map [as 别名]
# 或者: from Map.Map import query [as 别名]
def getUserMaps(id):
logging.info("getUserMaps id is " + str(id))
query = Map.query(Map.creatorId == id)
return query