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:40 PM, Héctor Velarde wrote: > 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) > Well maybe you can try my suggestion after some sleep. :) ------------------------------------------------------------------------------ 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 [email protected] https://lists.sourceforge.net/lists/listinfo/plone-developers