Commit 5454ac72 authored by Martijn Pieters's avatar Martijn Pieters

Massive style cleanup: Move to new raise exception style; for motivation, see:

    
  http://permalink.gmane.org/gmane.comp.web.zope.zope3/13884
parent b7863129
...@@ -417,7 +417,7 @@ class ClientStorage(object): ...@@ -417,7 +417,7 @@ class ClientStorage(object):
def doAuth(self, protocol, stub): def doAuth(self, protocol, stub):
if not (self._username and self._password): if not (self._username and self._password):
raise AuthError, "empty username or password" raise AuthError("empty username or password")
module = get_module(protocol) module = get_module(protocol)
if not module: if not module:
...@@ -430,7 +430,7 @@ class ClientStorage(object): ...@@ -430,7 +430,7 @@ class ClientStorage(object):
if not client: if not client:
log2("%s: %s isn't a valid protocol, must have a Client class" % log2("%s: %s isn't a valid protocol, must have a Client class" %
(self.__class__.__name__, protocol), level=logging.WARNING) (self.__class__.__name__, protocol), level=logging.WARNING)
raise AuthError, "invalid protocol" raise AuthError("invalid protocol")
c = client(stub) c = client(stub)
...@@ -472,7 +472,7 @@ class ClientStorage(object): ...@@ -472,7 +472,7 @@ class ClientStorage(object):
conn.setSessionKey(skey) conn.setSessionKey(skey)
else: else:
log2("Authentication failed") log2("Authentication failed")
raise AuthError, "Authentication failed" raise AuthError("Authentication failed")
try: try:
stub.register(str(self._storage), self._is_read_only) stub.register(str(self._storage), self._is_read_only)
......
...@@ -206,15 +206,15 @@ class ZEOStorage: ...@@ -206,15 +206,15 @@ class ZEOStorage:
immediately after authentication is finished. immediately after authentication is finished.
""" """
if self.auth_realm and not self.authenticated: if self.auth_realm and not self.authenticated:
raise AuthError, "Client was never authenticated with server!" raise AuthError("Client was never authenticated with server!")
if self.storage is not None: if self.storage is not None:
self.log("duplicate register() call") self.log("duplicate register() call")
raise ValueError, "duplicate register() call" raise ValueError("duplicate register() call")
storage = self.server.storages.get(storage_id) storage = self.server.storages.get(storage_id)
if storage is None: if storage is None:
self.log("unknown storage_id: %s" % storage_id) self.log("unknown storage_id: %s" % storage_id)
raise ValueError, "unknown storage: %s" % storage_id raise ValueError("unknown storage: %s" % storage_id)
if not read_only and (self.read_only or storage.isReadOnly()): if not read_only and (self.read_only or storage.isReadOnly()):
raise ReadOnlyError() raise ReadOnlyError()
......
...@@ -26,5 +26,5 @@ def get_module(name): ...@@ -26,5 +26,5 @@ def get_module(name):
def register_module(name, storage_class, client, db): def register_module(name, storage_class, client, db):
if _auth_modules.has_key(name): if _auth_modules.has_key(name):
raise TypeError, "%s is already registred" % name raise TypeError("%s is already registred" % name)
_auth_modules[name] = storage_class, client, db _auth_modules[name] = storage_class, client, db
...@@ -112,7 +112,7 @@ class StorageClass(ZEOStorage): ...@@ -112,7 +112,7 @@ class StorageClass(ZEOStorage):
# we sent to the client. It will need to generate a new # we sent to the client. It will need to generate a new
# nonce for a new connection anyway. # nonce for a new connection anyway.
if self._challenge != challenge: if self._challenge != challenge:
raise ValueError, "invalid challenge" raise ValueError("invalid challenge")
# lookup user in database # lookup user in database
h_up = self.database.get_password(user) h_up = self.database.get_password(user)
......
...@@ -62,8 +62,8 @@ class Database: ...@@ -62,8 +62,8 @@ class Database:
self.load() self.load()
if realm: if realm:
if self.realm and self.realm != realm: if self.realm and self.realm != realm:
raise ValueError, ("Specified realm %r differs from database " raise ValueError("Specified realm %r differs from database "
"realm %r" % (realm or '', self.realm)) "realm %r" % (realm or '', self.realm))
else: else:
self.realm = realm self.realm = realm
...@@ -109,7 +109,7 @@ class Database: ...@@ -109,7 +109,7 @@ class Database:
Callers must check for LookupError, which is raised in Callers must check for LookupError, which is raised in
the case of a non-existent user specified.""" the case of a non-existent user specified."""
if not self._users.has_key(username): if not self._users.has_key(username):
raise LookupError, "No such user: %s" % username raise LookupError("No such user: %s" % username)
return self._users[username] return self._users[username]
def hash(self, s): def hash(self, s):
...@@ -117,15 +117,15 @@ class Database: ...@@ -117,15 +117,15 @@ class Database:
def add_user(self, username, password): def add_user(self, username, password):
if self._users.has_key(username): if self._users.has_key(username):
raise LookupError, "User %s already exists" % username raise LookupError("User %s already exists" % username)
self._store_password(username, password) self._store_password(username, password)
def del_user(self, username): def del_user(self, username):
if not self._users.has_key(username): if not self._users.has_key(username):
raise LookupError, "No such user: %s" % username raise LookupError("No such user: %s" % username)
del self._users[username] del self._users[username]
def change_password(self, username, password): def change_password(self, username, password):
if not self._users.has_key(username): if not self._users.has_key(username):
raise LookupError, "No such user: %s" % username raise LookupError("No such user: %s" % username)
self._store_password(username, password) self._store_password(username, password)
...@@ -48,7 +48,7 @@ class HMAC: ...@@ -48,7 +48,7 @@ class HMAC:
self.update(msg) self.update(msg)
## def clear(self): ## def clear(self):
## raise NotImplementedError, "clear() method not available in HMAC." ## raise NotImplementedError("clear() method not available in HMAC.")
def update(self, msg): def update(self, msg):
"""Update this hashing object with the string msg. """Update this hashing object with the string msg.
......
...@@ -98,7 +98,7 @@ def get_port(): ...@@ -98,7 +98,7 @@ def get_port():
return port return port
finally: finally:
s.close() s.close()
raise RuntimeError, "Can't find port" raise RuntimeError("Can't find port")
class GenericTests( class GenericTests(
# Base class for all ZODB tests # Base class for all ZODB tests
......
...@@ -112,7 +112,7 @@ def main(args=None, dbclass=None): ...@@ -112,7 +112,7 @@ def main(args=None, dbclass=None):
# dbclass is used for testing tests.auth_plaintext, see testAuth.py # dbclass is used for testing tests.auth_plaintext, see testAuth.py
Database = dbclass Database = dbclass
else: else:
raise ValueError, "Unknown database type %r" % p raise ValueError("Unknown database type %r" % p)
if auth_db is None: if auth_db is None:
usage("Error: configuration does not specify auth database") usage("Error: configuration does not specify auth database")
db = Database(auth_db, auth_realm) db = Database(auth_db, auth_realm)
......
...@@ -55,7 +55,7 @@ class HMAC: ...@@ -55,7 +55,7 @@ class HMAC:
self.update(msg) self.update(msg)
## def clear(self): ## def clear(self):
## raise NotImplementedError, "clear() method not available in HMAC." ## raise NotImplementedError("clear() method not available in HMAC.")
def update(self, msg): def update(self, msg):
"""Update this hashing object with the string msg. """Update this hashing object with the string msg.
......
...@@ -66,8 +66,7 @@ class ConnectionManager(object): ...@@ -66,8 +66,7 @@ class ConnectionManager(object):
for addr in addrs: for addr in addrs:
addr_type = self._guess_type(addr) addr_type = self._guess_type(addr)
if addr_type is None: if addr_type is None:
raise ValueError, ( raise ValueError("unknown address in list: %s" % repr(addr))
"unknown address in list: %s" % repr(addr))
addrlist.append((addr_type, addr)) addrlist.append((addr_type, addr))
return addrlist return addrlist
......
...@@ -288,7 +288,7 @@ class BaseStorage(UndoLogCompatible): ...@@ -288,7 +288,7 @@ class BaseStorage(UndoLogCompatible):
def undo(self, transaction_id, txn): def undo(self, transaction_id, txn):
if self._is_read_only: if self._is_read_only:
raise POSException.ReadOnlyError() raise POSException.ReadOnlyError()
raise POSException.UndoError, 'non-undoable transaction' raise POSException.UndoError('non-undoable transaction')
def undoLog(self, first, last, filter=None): def undoLog(self, first, last, filter=None):
return () return ()
...@@ -313,7 +313,7 @@ class BaseStorage(UndoLogCompatible): ...@@ -313,7 +313,7 @@ class BaseStorage(UndoLogCompatible):
self._lock_release() self._lock_release()
def loadSerial(self, oid, serial): def loadSerial(self, oid, serial):
raise POSException.Unsupported, ( raise POSException.Unsupported(
"Retrieval of historical revisions is not supported") "Retrieval of historical revisions is not supported")
def loadBefore(self, oid, tid): def loadBefore(self, oid, tid):
......
...@@ -64,7 +64,7 @@ class PersistentReference: ...@@ -64,7 +64,7 @@ class PersistentReference:
return "PR(%s %s)" % (id(self), self.data) return "PR(%s %s)" % (id(self), self.data)
def __getstate__(self): def __getstate__(self):
raise PicklingError, "Can't pickle PersistentReference" raise PicklingError("Can't pickle PersistentReference")
class PersistentReferenceFactory: class PersistentReferenceFactory:
......
...@@ -103,7 +103,7 @@ class DemoStorage(BaseStorage): ...@@ -103,7 +103,7 @@ class DemoStorage(BaseStorage):
self._ltid = None self._ltid = None
self._clear_temp() self._clear_temp()
if base is not None and base.versions(): if base is not None and base.versions():
raise POSException.StorageError, ( raise POSException.StorageError(
"Demo base storage has version data") "Demo base storage has version data")
# While we officially don't support wrapping a non-read-only base # While we officially don't support wrapping a non-read-only base
...@@ -213,7 +213,7 @@ class DemoStorage(BaseStorage): ...@@ -213,7 +213,7 @@ class DemoStorage(BaseStorage):
except KeyError: except KeyError:
if self._base: if self._base:
return self._base.load(oid, '') return self._base.load(oid, '')
raise KeyError, oid raise KeyError(oid)
ver = "" ver = ""
if vdata: if vdata:
...@@ -224,11 +224,11 @@ class DemoStorage(BaseStorage): ...@@ -224,11 +224,11 @@ class DemoStorage(BaseStorage):
# data. # data.
oid, pre, vdata, p, skiptid = nv oid, pre, vdata, p, skiptid = nv
else: else:
raise KeyError, oid raise KeyError(oid)
ver = oversion ver = oversion
if p is None: if p is None:
raise KeyError, oid raise KeyError(oid)
return p, tid, ver return p, tid, ver
finally: self._lock_release() finally: self._lock_release()
...@@ -269,7 +269,7 @@ class DemoStorage(BaseStorage): ...@@ -269,7 +269,7 @@ class DemoStorage(BaseStorage):
if vdata: if vdata:
if vdata[0] != version: if vdata[0] != version:
raise POSException.VersionLockError, oid raise POSException.VersionLockError(oid)
nv=vdata[1] nv=vdata[1]
else: else:
...@@ -287,7 +287,7 @@ class DemoStorage(BaseStorage): ...@@ -287,7 +287,7 @@ class DemoStorage(BaseStorage):
if version: s=s+32+len(version) if version: s=s+32+len(version)
if self._quota is not None and s > self._quota: if self._quota is not None and s > self._quota:
raise POSException.StorageError, ( raise POSException.StorageError(
'''<b>Quota Exceeded</b><br> '''<b>Quota Exceeded</b><br>
The maximum quota for this demonstration storage The maximum quota for this demonstration storage
has been exceeded.<br>Have a nice day.''') has been exceeded.<br>Have a nice day.''')
......
...@@ -1322,7 +1322,7 @@ class FileStorage(BaseStorage.BaseStorage, ...@@ -1322,7 +1322,7 @@ class FileStorage(BaseStorage.BaseStorage,
raise POSException.ReadOnlyError() raise POSException.ReadOnlyError()
stop=`TimeStamp(*time.gmtime(t)[:5]+(t%60,))` stop=`TimeStamp(*time.gmtime(t)[:5]+(t%60,))`
if stop==z64: raise FileStorageError, 'Invalid pack time' if stop==z64: raise FileStorageError('Invalid pack time')
# If the storage is empty, there's nothing to do. # If the storage is empty, there's nothing to do.
if not self._index: if not self._index:
...@@ -1331,7 +1331,7 @@ class FileStorage(BaseStorage.BaseStorage, ...@@ -1331,7 +1331,7 @@ class FileStorage(BaseStorage.BaseStorage,
self._lock_acquire() self._lock_acquire()
try: try:
if self._pack_is_in_progress: if self._pack_is_in_progress:
raise FileStorageError, 'Already packing' raise FileStorageError('Already packing')
self._pack_is_in_progress = True self._pack_is_in_progress = True
current_size = self.getSize() current_size = self.getSize()
finally: finally:
...@@ -1624,10 +1624,10 @@ def read_index(file, name, index, vindex, tindex, stop='\377'*8, ...@@ -1624,10 +1624,10 @@ def read_index(file, name, index, vindex, tindex, stop='\377'*8,
if file_size: if file_size:
if file_size < start: if file_size < start:
raise FileStorageFormatError, file.name raise FileStorageFormatError(file.name)
seek(0) seek(0)
if read(4) != packed_version: if read(4) != packed_version:
raise FileStorageFormatError, name raise FileStorageFormatError(name)
else: else:
if not read_only: if not read_only:
file.write(packed_version) file.write(packed_version)
...@@ -1791,8 +1791,7 @@ def _truncate(file, name, pos): ...@@ -1791,8 +1791,7 @@ def _truncate(file, name, pos):
except: except:
logger.error("couldn\'t write truncated data for %s", name, logger.error("couldn\'t write truncated data for %s", name,
exc_info=True) exc_info=True)
raise POSException.StorageSystemError, ( raise POSException.StorageSystemError("Couldn't save truncated data")
"Couldn't save truncated data")
file.seek(pos) file.seek(pos)
file.truncate() file.truncate()
...@@ -1824,7 +1823,7 @@ class FileIterator(Iterator, FileStorageFormatter): ...@@ -1824,7 +1823,7 @@ class FileIterator(Iterator, FileStorageFormatter):
file = open(file, 'rb') file = open(file, 'rb')
self._file = file self._file = file
if file.read(4) != packed_version: if file.read(4) != packed_version:
raise FileStorageFormatError, file.name raise FileStorageFormatError(file.name)
file.seek(0,2) file.seek(0,2)
self._file_size = file.tell() self._file_size = file.tell()
self._pos = 4L self._pos = 4L
...@@ -1887,7 +1886,7 @@ class FileIterator(Iterator, FileStorageFormatter): ...@@ -1887,7 +1886,7 @@ class FileIterator(Iterator, FileStorageFormatter):
if self._file is None: if self._file is None:
# A closed iterator. Is IOError the best we can do? For # A closed iterator. Is IOError the best we can do? For
# now, mimic a read on a closed file. # now, mimic a read on a closed file.
raise IOError, 'iterator is closed' raise IOError('iterator is closed')
pos = self._pos pos = self._pos
while 1: while 1:
...@@ -1906,11 +1905,11 @@ class FileIterator(Iterator, FileStorageFormatter): ...@@ -1906,11 +1905,11 @@ class FileIterator(Iterator, FileStorageFormatter):
self._ltid = h.tid self._ltid = h.tid
if self._stop is not None and h.tid > self._stop: if self._stop is not None and h.tid > self._stop:
raise IndexError, index raise IndexError(index)
if h.status == "c": if h.status == "c":
# Assume we've hit the last, in-progress transaction # Assume we've hit the last, in-progress transaction
raise IndexError, index raise IndexError(index)
if pos + h.tlen + 8 > self._file_size: if pos + h.tlen + 8 > self._file_size:
# Hm, the data were truncated or the checkpoint flag wasn't # Hm, the data were truncated or the checkpoint flag wasn't
...@@ -1974,7 +1973,7 @@ class FileIterator(Iterator, FileStorageFormatter): ...@@ -1974,7 +1973,7 @@ class FileIterator(Iterator, FileStorageFormatter):
return result return result
raise IndexError, index raise IndexError(index)
class RecordIterator(Iterator, BaseStorage.TransactionRecord, class RecordIterator(Iterator, BaseStorage.TransactionRecord,
FileStorageFormatter): FileStorageFormatter):
...@@ -2023,7 +2022,7 @@ class RecordIterator(Iterator, BaseStorage.TransactionRecord, ...@@ -2023,7 +2022,7 @@ class RecordIterator(Iterator, BaseStorage.TransactionRecord,
r = Record(h.oid, h.tid, h.version, data, prev_txn, pos) r = Record(h.oid, h.tid, h.version, data, prev_txn, pos)
return r return r
raise IndexError, index raise IndexError(index)
class Record(BaseStorage.DataRecord): class Record(BaseStorage.DataRecord):
"""An abstract database record.""" """An abstract database record."""
......
...@@ -215,12 +215,12 @@ class MountPoint(persistent.Persistent, Acquisition.Implicit): ...@@ -215,12 +215,12 @@ class MountPoint(persistent.Persistent, Acquisition.Implicit):
try: try:
app = root['Application'] app = root['Application']
except: except:
raise MountedStorageError, ( raise MountedStorageError(
"No 'Application' object exists in the mountable database.") "No 'Application' object exists in the mountable database.")
try: try:
return app.unrestrictedTraverse(self._path) return app.unrestrictedTraverse(self._path)
except: except:
raise MountedStorageError, ( raise MountedStorageError(
"The path '%s' was not found in the mountable database." "The path '%s' was not found in the mountable database."
% self._path) % self._path)
......
...@@ -54,14 +54,14 @@ class _p_DataDescr(object): ...@@ -54,14 +54,14 @@ class _p_DataDescr(object):
return self return self
if '__global_persistent_class_not_stored_in_DB__' in inst.__dict__: if '__global_persistent_class_not_stored_in_DB__' in inst.__dict__:
raise AttributeError, self.__name__ raise AttributeError(self.__name__)
return inst._p_class_dict.get(self.__name__) return inst._p_class_dict.get(self.__name__)
def __set__(self, inst, v): def __set__(self, inst, v):
inst._p_class_dict[self.__name__] = v inst._p_class_dict[self.__name__] = v
def __delete__(self, inst): def __delete__(self, inst):
raise AttributeError, self.__name__ raise AttributeError(self.__name__)
class _p_oid_or_jar_Descr(_p_DataDescr): class _p_oid_or_jar_Descr(_p_DataDescr):
# Special descr for _p_oid and _p_jar that loads # Special descr for _p_oid and _p_jar that loads
...@@ -112,10 +112,10 @@ class _p_MethodDescr(object): ...@@ -112,10 +112,10 @@ class _p_MethodDescr(object):
return self.func.__get__(inst, cls) return self.func.__get__(inst, cls)
def __set__(self, inst, v): def __set__(self, inst, v):
raise AttributeError, self.__name__ raise AttributeError(self.__name__)
def __delete__(self, inst): def __delete__(self, inst):
raise AttributeError, self.__name__ raise AttributeError(self.__name__)
special_class_descrs = '__dict__', '__weakref__' special_class_descrs = '__dict__', '__weakref__'
......
...@@ -47,11 +47,11 @@ class PCounter2(PCounter): ...@@ -47,11 +47,11 @@ class PCounter2(PCounter):
class PCounter3(PCounter): class PCounter3(PCounter):
def _p_resolveConflict(self, oldState, savedState, newState): def _p_resolveConflict(self, oldState, savedState, newState):
raise AttributeError, "no attribute (testing conflict resolution)" raise AttributeError("no attribute (testing conflict resolution)")
class PCounter4(PCounter): class PCounter4(PCounter):
def _p_resolveConflict(self, oldState, savedState): def _p_resolveConflict(self, oldState, savedState):
raise RuntimeError, "Can't get here; not enough args" raise RuntimeError("Can't get here; not enough args")
class ConflictResolvingStorage: class ConflictResolvingStorage:
......
...@@ -99,7 +99,7 @@ def zodb_unpickle(data): ...@@ -99,7 +99,7 @@ def zodb_unpickle(data):
print >> sys.stderr, "can't find %s in %r" % (klassname, ns) print >> sys.stderr, "can't find %s in %r" % (klassname, ns)
inst = klass() inst = klass()
else: else:
raise ValueError, "expected class info: %s" % repr(klass_info) raise ValueError("expected class info: %s" % repr(klass_info))
state = u.load() state = u.load()
inst.__setstate__(state) inst.__setstate__(state)
return inst return inst
......
...@@ -86,7 +86,7 @@ class RecoverTest(unittest.TestCase): ...@@ -86,7 +86,7 @@ class RecoverTest(unittest.TestCase):
ZODB.fsrecover.recover(self.path, self.dest, ZODB.fsrecover.recover(self.path, self.dest,
verbose=0, partial=True, force=False, pack=1) verbose=0, partial=True, force=False, pack=1)
except SystemExit: except SystemExit:
raise RuntimeError, "recover tried to exit" raise RuntimeError("recover tried to exit")
finally: finally:
sys.stdout = orig_stdout sys.stdout = orig_stdout
return faux_stdout.getvalue() return faux_stdout.getvalue()
......
...@@ -102,7 +102,7 @@ class SerializerTestCase(unittest.TestCase): ...@@ -102,7 +102,7 @@ class SerializerTestCase(unittest.TestCase):
if name == "error": if name == "error":
raise ValueError("whee!") raise ValueError("whee!")
else: else:
raise AttributeError, name raise AttributeError(name)
class NewStyle(object): class NewStyle(object):
bar = "bar" bar = "bar"
......
...@@ -123,7 +123,7 @@ class MinimalMemoryStorage(BaseStorage, object): ...@@ -123,7 +123,7 @@ class MinimalMemoryStorage(BaseStorage, object):
try: try:
tids = [tid for oid, tid in self._index if oid == the_oid] tids = [tid for oid, tid in self._index if oid == the_oid]
if not tids: if not tids:
raise KeyError, the_oid raise KeyError(the_oid)
tids.sort() tids.sort()
i = bisect.bisect_left(tids, the_tid) - 1 i = bisect.bisect_left(tids, the_tid) - 1
if i == -1: if i == -1:
......
...@@ -54,5 +54,5 @@ def transact(f, note=None, retries=5): ...@@ -54,5 +54,5 @@ def transact(f, note=None, retries=5):
raise raise
continue continue
return r return r
raise RuntimeError, "couldn't commit transaction" raise RuntimeError("couldn't commit transaction")
return g return g
...@@ -73,7 +73,7 @@ class SampleOverridingGetattr(Persistent): ...@@ -73,7 +73,7 @@ class SampleOverridingGetattr(Persistent):
""" """
# Don't pretend we have any special attributes. # Don't pretend we have any special attributes.
if name.startswith("__") and name.endswrith("__"): if name.startswith("__") and name.endswrith("__"):
raise AttributeError, name raise AttributeError(name)
else: else:
return name.upper(), self._p_changed return name.upper(), self._p_changed
...@@ -178,7 +178,7 @@ class SampleOverridingGetattributeSetattrAndDelattr(Persistent): ...@@ -178,7 +178,7 @@ class SampleOverridingGetattributeSetattrAndDelattr(Persistent):
# Maybe it's a method: # Maybe it's a method:
meth = getattr(self.__class__, name, None) meth = getattr(self.__class__, name, None)
if meth is None: if meth is None:
raise AttributeError, name raise AttributeError(name)
return meth.__get__(self, self.__class__) return meth.__get__(self, self.__class__)
......
...@@ -52,7 +52,7 @@ def main(): ...@@ -52,7 +52,7 @@ def main():
opts, args = getopt.getopt(sys.argv[1:], 'f:') opts, args = getopt.getopt(sys.argv[1:], 'f:')
if not args: if not args:
usage() usage()
raise ValueError, "Must specify a FileStorage" raise ValueError("Must specify a FileStorage")
path = None path = None
for k, v in opts: for k, v in opts:
if k == '-f': if k == '-f':
......
...@@ -209,7 +209,7 @@ if __name__ == "__main__": ...@@ -209,7 +209,7 @@ if __name__ == "__main__":
try: try:
opts, args = getopt.getopt(sys.argv[1:], 'v') opts, args = getopt.getopt(sys.argv[1:], 'v')
if len(args) != 1: if len(args) != 1:
raise ValueError, "expected one argument" raise ValueError("expected one argument")
for k, v in opts: for k, v in opts:
if k == '-v': if k == '-v':
VERBOSE = VERBOSE + 1 VERBOSE = VERBOSE + 1
......
...@@ -197,7 +197,7 @@ def which(program): ...@@ -197,7 +197,7 @@ def which(program):
if not os.path.isabs(path): if not os.path.isabs(path):
path = os.path.abspath(path) path = os.path.abspath(path)
return path return path
raise IOError, "can't find %r on path %r" % (program, strpath) raise IOError("can't find %r on path %r" % (program, strpath))
def makedir(*args): def makedir(*args):
path = "" path = ""
......
...@@ -45,7 +45,7 @@ def connect(storage): ...@@ -45,7 +45,7 @@ def connect(storage):
storage._call.connect() storage._call.connect()
if storage._connected: if storage._connected:
return return
raise RuntimeError, "Unable to connect to ZEO server" raise RuntimeError("Unable to connect to ZEO server")
def pack1(addr, storage, days, wait): def pack1(addr, storage, days, wait):
cs = ClientStorage(addr, storage=storage, cs = ClientStorage(addr, storage=storage,
......
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