def get_file_infos(self, field_name=None):
"""Get the file infos associated to the uploads sent to this handler.
Args:
field_name: Only select uploads that were sent as a specific field.
Specify None to select all the uploads.
Returns:
A list of FileInfo records corresponding to each upload.
Empty list if there are no FileInfo records for field_name.
"""
if self.__file_infos is None:
self.__file_infos = collections.defaultdict(list)
for key, value in self.request.params.items():
if isinstance(value, cgi.FieldStorage):
if 'blob-key' in value.type_options:
self.__file_infos[key].append(blobstore.parse_file_info(value))
if field_name:
return list(self.__file_infos.get(field_name, []))
else:
results = []
for uploads in self.__file_infos.itervalues():
results.extend(uploads)
return results
blobstore_handlers.py 文件源码
python
阅读 16
收藏 0
点赞 0
评论 0
评论列表
文章目录