当前位置: 首页>>代码示例>>Python>>正文


Python BlobInfo.gql方法代码示例

本文整理汇总了Python中google.appengine.ext.blobstore.BlobInfo.gql方法的典型用法代码示例。如果您正苦于以下问题:Python BlobInfo.gql方法的具体用法?Python BlobInfo.gql怎么用?Python BlobInfo.gql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在google.appengine.ext.blobstore.BlobInfo的用法示例。


在下文中一共展示了BlobInfo.gql方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: upload_post_processing

# 需要导入模块: from google.appengine.ext.blobstore import BlobInfo [as 别名]
# 或者: from google.appengine.ext.blobstore.BlobInfo import gql [as 别名]
def upload_post_processing():
	file = request.files.data.filename
	# validate file is image format
	if mimetypes.guess_type(file)[0].split('/')[0] != 'image':
		# delete non-image file types
		BlobInfo.gql("WHERE filename = :fname", fname=file).get().delete()
		return template('upload_error.html')
	
	response.set_cookie('img', file, path='/')
	redirect('/upload_success')
开发者ID:AaronCRobinson,项目名称:python_glass_canteen,代码行数:12,代码来源:main.py

示例2: get_image

# 需要导入模块: from google.appengine.ext.blobstore import BlobInfo [as 别名]
# 或者: from google.appengine.ext.blobstore.BlobInfo import gql [as 别名]
def get_image(image):
	"""
	set header content type. 
	query blobstore, filter on filename, and execute query -> get BlobInfo
	open BlobReader with BlobInfo keyand read data -> return raw data
	"""
	#TODO: consider some kind of validation of file type and content?
	blob_info = BlobInfo.gql("WHERE filename = :fname", fname=image).get()
	response.content_type = blob_info.content_type
	return blobstore.BlobReader(blob_info).read()
开发者ID:AaronCRobinson,项目名称:python_glass_canteen,代码行数:12,代码来源:main.py

示例3: filter

# 需要导入模块: from google.appengine.ext.blobstore import BlobInfo [as 别名]
# 或者: from google.appengine.ext.blobstore.BlobInfo import gql [as 别名]
def filter(filename, chrm, start, end, filters):
    out = []

    indexname = "%s.index.%s.json" % (filename, chrm)
    log("attempting to load from m cache")
    index = memcache.get(indexname)
    if index is None:
        log("mcache loading failed, loading from blobstore")
        blob = BlobInfo.gql("where filename = '%s'" % (indexname)).get()
        if not blob is None:
            log("mcache loading failed, parseing from json")
            index = json.load(blob.open())
            log("adding to memcache")
            try:
                if not memcache.add(indexname, index):
                    logging.error("Memcache set failed.")
            except ValueError:
                logging.info("Memcache value error.")

    if not index is None:
        leftbound = bisect_left(index, start)
        rightbound = bisect_right(index, end)
        for edge in index[leftbound:rightbound]:
            # if edge < start:
            # 	continue
            # if edge["Pos1"] > end:
            # 	break

            includeme = False
            if filters != False:
                for filter in filters:
                    if edge["Type"] == filter["type"] and int(edge["Score"]) >= int(filter["minscore"]):
                        includeme = True
                        break
            else:
                includeme = True
            if includeme == True:
                out.append(edge)
    return out
开发者ID:ryanbressler,项目名称:cloudbreakline,代码行数:41,代码来源:transplantws.py


注:本文中的google.appengine.ext.blobstore.BlobInfo.gql方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。