Commit 29f4cd3f authored by Jeremy Hylton's avatar Jeremy Hylton

Initialize _begun to 0, not None.

parent 565f9a71
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
############################################################################## ##############################################################################
"""Database connection support """Database connection support
$Id: Connection.py,v 1.76 2002/09/16 23:50:39 jeremy Exp $""" $Id: Connection.py,v 1.77 2002/10/04 20:44:25 jeremy Exp $"""
from cPickleCache import PickleCache, MUCH_RING_CHECKING from cPickleCache import PickleCache, MUCH_RING_CHECKING
from POSException import ConflictError, ReadConflictError from POSException import ConflictError, ReadConflictError
...@@ -270,7 +270,7 @@ class Connection(ExportImport.ExportImport): ...@@ -270,7 +270,7 @@ class Connection(ExportImport.ExportImport):
# NB: commit() is responsible for calling tpc_begin() on the storage. # NB: commit() is responsible for calling tpc_begin() on the storage.
# It uses self._begun to track whether it has been called. When # It uses self._begun to track whether it has been called. When
# self._begun is None, it has not been called. # self._begun is 0, it has not been called.
# This arrangement allows us to handle the special case of a # This arrangement allows us to handle the special case of a
# transaction with no modified objects. It is possible for # transaction with no modified objects. It is possible for
...@@ -285,7 +285,7 @@ class Connection(ExportImport.ExportImport): ...@@ -285,7 +285,7 @@ class Connection(ExportImport.ExportImport):
def commit(self, object, transaction): def commit(self, object, transaction):
if object is self: if object is self:
if self._begun is None: if not self._begun:
self._storage.tpc_begin(transaction) self._storage.tpc_begin(transaction)
self._begun = 1 self._begun = 1
...@@ -313,7 +313,7 @@ class Connection(ExportImport.ExportImport): ...@@ -313,7 +313,7 @@ class Connection(ExportImport.ExportImport):
# Nothing to do # Nothing to do
return return
if self._begun is None: if not self._begun:
self._storage.tpc_begin(transaction) self._storage.tpc_begin(transaction)
self._begun = 1 self._begun = 1
...@@ -623,7 +623,7 @@ class Connection(ExportImport.ExportImport): ...@@ -623,7 +623,7 @@ class Connection(ExportImport.ExportImport):
def tpc_begin(self, transaction, sub=None): def tpc_begin(self, transaction, sub=None):
self._invalidating = [] self._invalidating = []
self._creating = [] self._creating = []
self._begun = None self._begun = 0
if sub: if sub:
# Sub-transaction! # Sub-transaction!
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment