本文整理汇总了Python中models.Image.get_all_Images方法的典型用法代码示例。如果您正苦于以下问题:Python Image.get_all_Images方法的具体用法?Python Image.get_all_Images怎么用?Python Image.get_all_Images使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Image
的用法示例。
在下文中一共展示了Image.get_all_Images方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import Image [as 别名]
# 或者: from models.Image import get_all_Images [as 别名]
def get(self):
# Get the all user pics
pics = Image.get_all_Images()
params = {}
if self.session.get('Error_Message'):
params = {
'Error_Message': str(self.session.get('Error_Message'))
}
if self.session.get('mail'):
mail = self.session.get('mail')
params.update({
'log': "", 'logged': "none"
})
else:
mail = ''
params.update({
'log': "none", 'logged': ""
})
self.session['Error_Message'] = None
page = template.render('templates/Home_Header.html', params)
if not pics:
self.error(404)
else:
for pic in pics:
if not blobstore.get(pic.blob_key):
logging.error('oops something went Terribly wrong.')
else:
key = blobstore.get(pic.blob_key)
blob_info = blobstore.BlobInfo.get(pic.blob_key)
# This Code Fails in Production
url = '/view_photo/' + str(pic.blob_key)
comments = Comment.get_Detail(pic.key)
context = {'id': pic.key.id(), 'Name': pic.name,
'url': url, 'user': pic.author,
'comments': comments, 'nlikes': pic.Like,
'ndislikes': pic.Dislike,
'email': mail
}
if blob_info.content_type in image_types:
page = page + \
template.render(
'templates/Home_Form_Image.html', context)
elif blob_info.content_type in video_types:
page = page + \
template.render(
'templates/Home_Form_Video.html', context)
else:
logging.error("Something is Missed" + str(pic.id))
page = page + template.render('templates/Home_footer.html', {})
self.response.write(page)