Skip to content

Commit

Permalink
Updated get_value to test if attribute exist on object
Browse files Browse the repository at this point in the history
  • Loading branch information
sgeulette committed Apr 10, 2020
1 parent 86bbd13 commit 5f11a82
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Changelog
3.14 (unreleased)
-----------------

- Nothing changed yet.

- Updated get_value to test if attribute exist on object.
[sgeulette]

3.13 (2020-03-04)
-----------------
Expand Down
3 changes: 2 additions & 1 deletion src/collective/documentgenerator/helper/dexterity.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from plone.behavior.interfaces import IBehavior
from plone.rfc822.interfaces import IPrimaryFieldInfo
from plone.supermodel.utils import mergedTaggedValueDict
from Products.CMFPlone.utils import base_hasattr
from z3c.form.interfaces import NO_VALUE
from zope.component import getMultiAdapter
from zope.component import getUtility
Expand Down Expand Up @@ -84,7 +85,7 @@ def get_value(self, field_name, default=None, as_utf8=False, strict=True):
"""
strict: if False and field doesn't exist, be cool and return default value
"""
if not strict and not self.has_field(field_name):
if not strict and not base_hasattr(self.real_context, field_name):
return default
value = getattr(self.real_context, field_name)
if value is None:
Expand Down

0 comments on commit 5f11a82

Please sign in to comment.