-
-
Notifications
You must be signed in to change notification settings - Fork 196
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
Conversation
may you add a note to the changelog please? |
683970b
to
197fae6
Compare
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: |
There was a problem hiding this comment.
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))
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
197fae6
to
ad873f9
Compare
Changelog added and indexer updated |
lets get jenkins opinion :) http://jenkins.plone.org/job/pull-request-5.0/606/ |
Archetypes show a broken img as icon since #1226