Never Use Python If Obj if Obj Is Not A Simple Type
Truth value testing on Zope / ERP5 objects has surprising behavior. For example "if obj" returns false if the object is an empty folder, and "if obj" returns true if it is a folder with sub objects. This is because python uses __len__ if __nonzero__ method doesn't exist on object. So "if obj" MUST NOT be used to check if the object is None.
Good Example:
document = context.getFollowUpRelatedValue(portal_type='File')
if document is None:
document = ...
Bad Example:
document = context.getFollowUpRelatedValue(portal_type='File')
if not document:
# Here document may exist, but the conditional is False as document doesn't have sub-objects