Esempio n. 1
0
 def _add_to_checklist(self, path, dbname):
     filestore = get_store_path(dbname)
     relpath = os.path.relpath(path, filestore)
     checklist = os.path.join(filestore, 'checklist', relpath)
     if not os.path.exists(checklist):
         ensure_path_directories(checklist)
         open(checklist, 'ab').close()
Esempio n. 2
0
 def _get_file_path(self, checksume, dbname):
     name =  os.path.join(checksume[:2], checksume)
     name = re.sub('[.]', '', name).strip('/\\')
     filestore = get_store_path(dbname)
     path = os.path.join(filestore, name)
     ensure_path_directories(path)
     return path 
Esempio n. 3
0
 def test_ensure_path_directories(self):
     tmp_dir = tempfile.mkdtemp()
     try:
         path = os.path.join(tmp_dir, "Test/Test/")
         file.ensure_path_directories(path)
         self.assertTrue(os.path.exists(path))
     finally:
         shutil.rmtree(tmp_dir)
     return True