Re: getImage method inside ATFile

Héctor Velarde <[email protected]>
Newsgroups gmane.comp.web.zope.plone.devel
Message-ID <[email protected]>
On 12/08/13 22:16, David Glick (Plone) wrote:
> 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()

thanks, David; my use case is the following:

if the object has an image field or a getImage method, do something:

def image_tag(self, item):
     """Return an image tag based on the tile configuration.
     """
     # we look here for an image field or a getImage method in the object
     # if none available, we just return an empty tag
     if not hasattr(item, 'image') and not hasattr(item, 'getImage'):
         return u''
     ...

https://github.com/collective/collective.cover/commit/8afac58653616344442c530fa0894ec89af49f4d#L0R210

but this is obviously wrong, it's late and I'm tired.

(this is your same use case, aclark, in case you're reading this)

thanks!

------------------------------------------------------------------------------
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

_______________________________________________
Plone-developers mailing list
Plone-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/plone-developers
smime.p7s (application/pkcs7-signature, 3.7 KB) - not displayed
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.