- change : 去掉了对 shelve 的使用,同时不再依赖于 bsddb。此时没有bsddb的Python3,应该可以使用。

This commit is contained in:
lamter 2017-04-27 15:39:33 +08:00
parent 45d4301110
commit 1e1ca13655

View File

@ -1,6 +1,6 @@
# encoding: UTF-8 # encoding: UTF-8
import shelve # import shelve
from collections import OrderedDict from collections import OrderedDict
from datetime import datetime from datetime import datetime
@ -311,19 +311,21 @@ class DataEngine(object):
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def saveContracts(self): def saveContracts(self):
"""保存所有合约对象到硬盘""" """保存所有合约对象到硬盘"""
f = shelve.open(self.contractFileName) pass
f['data'] = self.contractDict # f = shelve.open(self.contractFileName)
f.close() # f['data'] = self.contractDict
# f.close()
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def loadContracts(self): def loadContracts(self):
"""从硬盘读取合约对象""" """从硬盘读取合约对象"""
f = shelve.open(self.contractFileName) pass
if 'data' in f: # f = shelve.open(self.contractFileName)
d = f['data'] # if 'data' in f:
for key, value in d.items(): # d = f['data']
self.contractDict[key] = value # for key, value in d.items():
f.close() # self.contractDict[key] = value
# f.close()
#---------------------------------------------------------------------- #----------------------------------------------------------------------
def updateOrder(self, event): def updateOrder(self, event):