def isAVersionableResource(obj):
    """ True if an object is versionable.

    To qualify, the object must be persistent (have its own db record), and
    must not have an true attribute named '__non_versionable__'."""

    if getattr(obj, '__non_versionable__', 0):
        return 0
    return hasattr(obj, '_p_oid')