Make dbhash optional
This commit is contained in:
parent
843a42b982
commit
1a4e3b9885
@ -1,5 +1,5 @@
|
|||||||
from glob import glob
|
from glob import glob
|
||||||
import os, sys, dbhash
|
import os, sys
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
rootdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
rootdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
@ -13,6 +13,7 @@ def open():
|
|||||||
cache = config.cache_directory()
|
cache = config.cache_directory()
|
||||||
index=os.path.join(cache,'index')
|
index=os.path.join(cache,'index')
|
||||||
if not os.path.exists(index): return None
|
if not os.path.exists(index): return None
|
||||||
|
import dbhash
|
||||||
return dbhash.open(filename(index, 'id'),'w')
|
return dbhash.open(filename(index, 'id'),'w')
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
if e.__class__.__name__ == 'DBError': e = e.args[-1]
|
if e.__class__.__name__ == 'DBError': e = e.args[-1]
|
||||||
@ -34,6 +35,7 @@ def create():
|
|||||||
cache = config.cache_directory()
|
cache = config.cache_directory()
|
||||||
index=os.path.join(cache,'index')
|
index=os.path.join(cache,'index')
|
||||||
if not os.path.exists(index): os.makedirs(index)
|
if not os.path.exists(index): os.makedirs(index)
|
||||||
|
import dbhash
|
||||||
index = dbhash.open(filename(index, 'id'),'c')
|
index = dbhash.open(filename(index, 'id'),'c')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user