本文整理汇总了Python中models.Images.all方法的典型用法代码示例。如果您正苦于以下问题:Python Images.all方法的具体用法?Python Images.all怎么用?Python Images.all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Images
的用法示例。
在下文中一共展示了Images.all方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import Images [as 别名]
# 或者: from models.Images import all [as 别名]
def get(self):
collector = CloudFetch.CloudFetch()
urllist = collector.getUrlList()
#url = 'http://www.technobuffalo.com/wp-content/uploads/2012/12/Google-Apps.jpeg'
#urllist = urllist.append(url)
images = Images.all()
for url in urllist:
bf = urllib.urlopen(url).read()
#bf=self.request.get("file")
if not bf:
return self.redirect('/')
#name=self.request.body_file.vars['file'].filename
#mime = self.request.body_file.vars['file'].headers['content-type']
#if mime.find('image')==-1:
# return self.redirect('/admin/upload/')
#description=self.request.get("description")
mime = 'image'
description = 'Fetched From Cloud'
name = url.split('/')[len(url.split('/'))-1]
#DETECT DUPLICATE
flag = False;
for i in images:
if(i.name == name):
flag = True
break
if(flag == True):
continue
image=methods.addImage( mime, description, bf, name)
self.redirect('/')
示例2: index
# 需要导入模块: from models import Images [as 别名]
# 或者: from models.Images import all [as 别名]
def index(self):
user_id = cherrypy.session.get('user.id')
vms = VirtualMachines.find(user_id=user_id)
env = dict(
virtual_machines=vms,
images=Images.all(),
instance_types=InstanceTypes.all()
)
return self.render("virtual_machines/index.html", self.crumbs, **env)
示例3: running
# 需要导入模块: from models import Images [as 别名]
# 或者: from models.Images import all [as 别名]
def running(self):
creds = cherrypy.session.get('credentials')
vms = VirtualMachines.all()
images = Images.all()
instances = VirtualMachines.get_instances(creds)
env = dict(
virtual_machines=vms,
instances=instances,
images=images,
)
return self.render("virtual_machines/running.html", self.crumbs,**env)
示例4: index
# 需要导入模块: from models import Images [as 别名]
# 或者: from models.Images import all [as 别名]
def index(self):
#Images.add(Images.new(id="test", name="test"))
env = dict(
images=Images.all(),
)
return self.render("images/index.html", self.crumbs, **env)
示例5: backup
# 需要导入模块: from models import Images [as 别名]
# 或者: from models.Images import all [as 别名]
def backup(self):
images=Images.all().fetch(PAGESIZE)
while images:
for image in images:
self.save(image)
images = Images.all().filter('__key__ >', images[-1].key()).fetch(PAGESIZE)
示例6: getAllImagesByTag
# 需要导入模块: from models import Images [as 别名]
# 或者: from models.Images import all [as 别名]
def getAllImagesByTag(tag):
#return db.GqlQuery(u"SELECT * FROM Images WHERE tag=:1",unicode(tag, 'UTF-8'))
return Images.all().filter('tag =', unicode(tag, 'UTF-8')).order('-created_at')
示例7: getAllImages
# 需要导入模块: from models import Images [as 别名]
# 或者: from models.Images import all [as 别名]
def getAllImages(index=0):
return Images.all().order('-created_at').fetch(25,index*24)
示例8: getImagesBefore
# 需要导入模块: from models import Images [as 别名]
# 或者: from models.Images import all [as 别名]
def getImagesBefore(count=100, lastImage_date=None):
if lastImage_date:
return db.GqlQuery("SELECT * FROM Images WHERE created_at < :1 ORDER BY created_at DESC", lastImage_date).fetch(count)
else:
return Images.all().order('-created_at').fetch(count)
示例9: getImages
# 需要导入模块: from models import Images [as 别名]
# 或者: from models.Images import all [as 别名]
def getImages(count=100, offset=0):
return Images.all().order('-created_at').fetch(count, offset)