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


Python Photo.get方法代码示例

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


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

示例1: remove_current_photo

# 需要导入模块: from models import Photo [as 别名]
# 或者: from models.Photo import get [as 别名]
	def remove_current_photo(self, album_id='', photo_id=''):
		if request.method == 'GET':
			if photo_id:
				try:
					photo = Photo.get(id=photo_id)
					photo.delete_instance()
					flash(u"Фотографія %s успішно видалина." % photo.title)
				except DoesNotExist, e:
					print '%s' % e
开发者ID:lpfan,项目名称:Wing-M.S.,代码行数:11,代码来源:gallery.py

示例2: remove_photo

# 需要导入模块: from models import Photo [as 别名]
# 或者: from models.Photo import get [as 别名]
	def remove_photo(self, album_id=''):
		if request.method == 'POST':
			form = request.form
			for v in form.itervalues():
				try:
					photo = Photo.get(id=v)
					photo.delete_instance()
				except DoesNotExist, e:
					print '%s' % e
开发者ID:lpfan,项目名称:Wing-M.S.,代码行数:11,代码来源:gallery.py

示例3: photo

# 需要导入模块: from models import Photo [as 别名]
# 或者: from models.Photo import get [as 别名]
def photo(request, owner, nb):
    try:
        photo = Photo.get(owner, nb)
        owner = User.get(owner)
        return render(request, 'photo.html', {
            'owner': owner,
            'photo': photo
        })
    except (Photo.DoesNotExist, User.DoesNotExist):
        return HttpResponseRedirect('/')
开发者ID:savix,项目名称:jnp3,代码行数:12,代码来源:views.py

示例4: prepare_photo_files

# 需要导入模块: from models import Photo [as 别名]
# 或者: from models.Photo import get [as 别名]
def prepare_photo_files(owner, nb):
    storage = Client(domain = settings.MOGILEFS_DOMAIN,
            trackers = settings.MOGILEFS_TRACKERS)
    #im = Image.open(path.join(settings.UNPROCESSED_PHOTOS_DIR, '%s.jpg' % id))
    f = storage.read_file(path.join(settings.UNPROCESSED_PHOTOS_DIR, '%s,%s.jpg' % (owner, nb)))
    im = Image.open(f)
    im.thumbnail((160, 160), Image.ANTIALIAS)

    tn = storage.new_file(path.join(settings.PROCESSED_PHOTOS_DIR, '%s,%s-160x160.jpg' % (owner, nb)))
    im.save(tn, 'JPEG')

    #sleep(20)
    photo = Photo.get(owner, nb)
    photo.ready()
开发者ID:savix,项目名称:jnp3,代码行数:16,代码来源:tasks.py

示例5: form

# 需要导入模块: from models import Photo [as 别名]
# 或者: from models.Photo import get [as 别名]
    def form(self):
        if self.request.args.get('photo'):
            key=db.Key(self.request.args['photo'])
            photo=Photo.get(key)
            form_data=MultiDict({
                'name':photo.name,
                'existing_photo':key,
                'email':photo.email,
                'phone':photo.phone,

            
            
            }.iteritems())
            
            
            return(AddPhotoForm(form_data))
            
        else:
            return AddPhotoForm(self.request.form)
开发者ID:rosskarchner,项目名称:colvinrunmill,代码行数:21,代码来源:handlers.py

示例6: get

# 需要导入模块: from models import Photo [as 别名]
# 或者: from models.Photo import get [as 别名]
    def get(self, photo_id):
        photo = Photo.get(photo_id)
        if photo:

            if self.request.get('type'):
                force_crop = self.request.get('crop', False)
                if force_crop: force_crop = True
                cropped, img = crop_image(photo.file, self.request.get('type'),
                                          strict=force_crop)
                if img:
                    self.response.headers['Content-Type'] = 'image/jpg'
                    self.response.out.write(img)
                else:
                    self.response.out.write('No image')

            self.response.headers['Content-Type'] = str('image/%s' % photo.extension)
            self.response.out.write(photo.file)

        else:
            self.response.out.write('No image')
开发者ID:ekaputra07,项目名称:bokerface,代码行数:22,代码来源:site.py

示例7: parse_item

# 需要导入模块: from models import Photo [as 别名]
# 或者: from models.Photo import get [as 别名]
    def parse_item(self,item):
        name = item.xpath("div[@class='user-info']/h3/a")[0].text
        twitter = item.xpath("div[@class='user-info']/h3/span/a")[0].text
  

        avators = item.xpath("div[@class='photo-link-outer']/a/img//@src")

        with db_session:
            girl = Girl.get(twitter=twitter)
            if girl is None:
                girl = Girl(name=name,twitter=twitter)
            else:
                girl.name = name
            commit()
            for avator in avators:
                photo = Photo.get(link=avator)
                if photo is None:
                    try:
                        local = crawl_photo(avator)
                        photo = Photo(uid=girl.id,link=avator,local=local)
                        commit()
                    except requests.exceptions.ConnectionError:
                        pass
开发者ID:kulasama,项目名称:girls,代码行数:25,代码来源:bot.py

示例8: post

# 需要导入模块: from models import Photo [as 别名]
# 或者: from models.Photo import get [as 别名]
 def post(self, photo_id):
     if self.request.get('action') == 'delete':
         photo = Photo.get(photo_id)
         if photo:
             photo.delete()
     self.response.out.write('ok')
开发者ID:ekaputra07,项目名称:bokerface,代码行数:8,代码来源:site.py


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