Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def get_filenames():
result = []
for filename in os.listdir(dirname):
if filename.startswith(db_filename) and filename != db_filename:
file_time = int(filename.split("-")[-1])
if file_time > timestamp:
result.append(filename)
result = sorted(result)
if os.path.isfile(self.db_file):
result += [db_filename]
return result
with self.lock:
self.restoring_mode = True
for filename in get_filenames():
f = bsddb3.rnopen(os.path.join(dirname, filename), "r")
for k, v in f.items():
try:
obj = cPickle.loads(v)
obj.Redo(self)
except Exception, e:
logging.exception("occurred in TagLogger while restoring from a journal : %s", e)
f.close()
self.restoring_mode = False
def Open(self, filename):
self.file = bsddb3.rnopen(filename, "c")
self.file_opened = True