Re: getImage method inside ATFile

"David Glick (Plone)" <david.glick-z4DKO/[email protected]>
Newsgroups gmane.comp.web.zope.plone.devel
Message-ID <[email protected]>
On 8/12/13 6:09 PM, Héctor Velarde wrote:
> can somebody explain me why there is a getImage method on the File 
> content type?
>
> (Pdb) item
> <ATFile at /Plone/my_file.pdf>
> (Pdb) item.image
> *** AttributeError: image
> (Pdb) item.getImage
> <bound method ATBlob.getImage of <ATFile at /Plone/my_file.pdf>>
> (Pdb) item.getImage()
> <plone.app.blob.field.BlobWrapper object at 0x7f9ae0e1c1b8>
>
> is this a bug on plone.app.blob? I don't see were do we get it:
>
> https://github.com/plone/plone.app.blob/blob/master/src/plone/app/blob/field.py 
>
>
It comes from ImageMixin which is mixed into ATBlob in content.py for 
backwards compatibility with ATImage. The blob-based File and Image 
types are both actually instances of ATBlob.

If you're looking for a generic way to see if an Archetypes item has an 
image, it's probably best to check if there's a field called 'image' in 
item.Schema()

David

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.