• Jeremy Hylton's avatar
    Handle empty transactions without touching the storage. · d7a558d1
    Jeremy Hylton authored
    # NB: commit() is responsible for calling tpc_begin() on the storage.
    # It uses self._begun to track whether it has been called.  When
    # self._begun is None, it has not been called.
    
    # This arrangement allows us to handle the special case of a
    # transaction with no modified objects.  It is possible for
    # registration to be occur unintentionally and for a persistent
    # object to compensate by making itself as unchanged.  When this
    # happens, it's possible to commit a transaction with no modified
    # objects.
    
    # Since tpc_begin() may raise a ReadOnlyError, don't call it if there
    # are no objects.  This avoids spurious (?) errors when working with
    # a read-only storage.
    
    Add code to handle this in Connection's tpc_begin() and commit()
    methods.
    
    Add two tests in testZODB.
    d7a558d1
Connection.py 24.6 KB