Checking if an Object is in the Portal Factory
If you need to know if you're dealing with a temporary object, this is the right way to do it.
Taken from Martin Aspeli's contentrules package (handers.py):
def is_portal_factory(context):
"""Find out if the given object is in portal_factory
"""
portal_factory = getToolByName(context, 'portal_factory', None)
if portal_factory is not None:
return portal_factory.isTemporary(context)
else:
return False
