Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: getIcon for archetypes #1271

Merged
merged 1 commit into from
Dec 3, 2015
Merged

fix: getIcon for archetypes #1271

merged 1 commit into from
Dec 3, 2015

Conversation

Gagaro
Copy link
Member

@Gagaro Gagaro commented Dec 1, 2015

Archetypes show a broken img as icon since #1226

@jensens
Copy link
Member

jensens commented Dec 1, 2015

may you add a note to the changelog please?

when obj is an image or has a lead image
or has an image field with name 'image': true else false
"""
if obj.aq_base.image:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the image attribute does not exist an AttributeError would be raised, is this intended? If not I'd change to

return bool(getattr(obj.aq_base, 'image', False))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An exception in an indexer would just give an empty value, which is okay in this case. I copied this from plone/plone.app.contenttypes@3cfc044.

I like yours better though, I'll update it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, ok, usally if I see something like

if (some condition):
    return True
return False

I tend to normalize to

return bool(condition)

even bool() is not needed always, but for an indexer its good to return explicit values.

@Gagaro Gagaro force-pushed the fix-geticon-archetypes branch from 197fae6 to ad873f9 Compare December 2, 2015 09:49
@Gagaro
Copy link
Member Author

Gagaro commented Dec 2, 2015

Changelog added and indexer updated

@jensens
Copy link
Member

jensens commented Dec 2, 2015

lets get jenkins opinion :) http://jenkins.plone.org/job/pull-request-5.0/606/

jensens added a commit that referenced this pull request Dec 3, 2015
@jensens jensens merged commit 530ebe6 into master Dec 3, 2015
@jensens jensens deleted the fix-geticon-archetypes branch December 3, 2015 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants