Commit 5d604d32 authored by Jeremy Hylton's avatar Jeremy Hylton

Remove unused imports and reorganize import block.

parent b71f62f4
...@@ -13,17 +13,16 @@ ...@@ -13,17 +13,16 @@
############################################################################## ##############################################################################
"""Transaction management """Transaction management
$Id: Transaction.py,v 1.50 2003/10/02 18:17:19 jeremy Exp $ $Id: Transaction.py,v 1.51 2003/10/02 20:17:36 jeremy Exp $
""" """
import sys
import time, sys, struct, POSException
from string import split, strip, join
from zLOG import LOG, ERROR, PANIC, INFO, BLATHER, WARNING from zLOG import LOG, ERROR, PANIC, INFO, BLATHER, WARNING
from POSException import ConflictError from ZODB.POSException import ConflictError, TransactionError
from utils import oid_repr from ZODB.utils import oid_repr
# Flag indicating whether certain errors have occurred. # Flag indicating whether certain errors have occurred.
hosed=0 hosed = 0
# There is an order imposed on all jars, based on the storages they # There is an order imposed on all jars, based on the storages they
# serve, that must be consistent across all applications using the # serve, that must be consistent across all applications using the
...@@ -101,7 +100,7 @@ class Transaction: ...@@ -101,7 +100,7 @@ class Transaction:
entered two-phase commit yet, so no tpc_ messages are sent. entered two-phase commit yet, so no tpc_ messages are sent.
""" """
if subtransaction and (self._non_st_objects is not None): if subtransaction and (self._non_st_objects is not None):
raise POSException.TransactionError, ( raise TransactionError(
"""Attempted to abort a sub-transaction, but a participating """Attempted to abort a sub-transaction, but a participating
data manager doesn't support partial abort. data manager doesn't support partial abort.
""") """)
...@@ -169,9 +168,9 @@ class Transaction: ...@@ -169,9 +168,9 @@ class Transaction:
if self._objects: if self._objects:
self.abort(subtransaction, 0) self.abort(subtransaction, 0)
if info: if info:
info=split(info,'\t') L = info.split("\t")
self.user=strip(info[0]) self.user = L[0].strip()
self.description=strip(join(info[1:],'\t')) self.description = "\t".join(L[1:]).strip()
def commit(self, subtransaction=None): def commit(self, subtransaction=None):
"""Finalize the transaction.""" """Finalize the transaction."""
...@@ -206,7 +205,7 @@ class Transaction: ...@@ -206,7 +205,7 @@ class Transaction:
if (objects or subjars) and hosed: if (objects or subjars) and hosed:
# Something really bad happened and we don't # Something really bad happened and we don't
# trust the system state. # trust the system state.
raise POSException.TransactionError, hosed_msg raise TransactionError(hosed_msg)
# It's important that: # It's important that:
# #
...@@ -426,18 +425,17 @@ class Transaction: ...@@ -426,18 +425,17 @@ class Transaction:
def note(self, text): def note(self, text):
if self.description: if self.description:
self.description = "%s\n\n%s" % (self.description, strip(text)) self.description = "%s\n\n%s" % (self.description, test.strip())
else: else:
self.description = strip(text) self.description = text.strip()
def setUser(self, user_name, path='/'): def setUser(self, user_name, path='/'):
self.user="%s %s" % (path, user_name) self.user = "%s %s" % (path, user_name)
def setExtendedInfo(self, name, value): def setExtendedInfo(self, name, value):
ext=self._extension if self._extension is None:
if ext is None: self._extension = {}
ext=self._extension={} self._extension[name] = value
ext[name]=value
hosed_msg = \ hosed_msg = \
"""A serious error, which was probably a system error, """A serious error, which was probably a system error,
......
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