7 path = os.path.join(Crossfire.LocalDirectory(),
'ImperialBank_DB.db')
8 if os.path.isfile(path):
9 Crossfire.Log(Crossfire.LogInfo,
"Converting ImperialBank_DB.db (BDB)")
10 import berkeleydb.dbshelve
as shelve
11 accounts = shelve.open(path,
'r')
12 for account
in accounts.keys():
13 name = account.decode(
'ascii')
14 balance = accounts[account]
15 bank.deposit(name, balance)
17 bak_file = os.path.join(Crossfire.LocalDirectory(),
'ImperialBank_DB.db.bak')
18 os.rename(path, bak_file)
21 path = os.path.join(Crossfire.LocalDirectory(),
'ImperialBank_DB')
22 if os.path.isfile(path):
23 Crossfire.Log(Crossfire.LogInfo,
"Converting ImperialBank_DB (DBM)")
25 s = shelve.open(path,
'r')
26 for name, balance
in s.iteritems():
27 bank.deposit(name, balance)
29 bak_file = os.path.join(Crossfire.LocalDirectory(),
'ImperialBank_DB.bak')
30 os.rename(path, bak_file)
33 Crossfire.Log(Crossfire.LogInfo,
"Initializing CFBank")