- directory = file_path[:len(config.get('DEFAULT', 'cache_dir'))]
- url_path = file_path[len(config.get('DEFAULT', 'cache_dir')):]
- if url_path[0] == '/':
- url_path = url_path[1:]
- top_directory = url_path.split('/',1)[0]
- url_path = url_path[len(top_directory):]
- http_dir = os.path.join(directory, top_directory)
- new_top = self.http_server.addDirectory(http_dir)
- url_path = '/' + new_top + url_path
- log.msg('now avaliable at %s: %s' % (url_path, url))
+ urlpath, newdir = self.db.storeFile(file_path, hash.digest(), config.get('DEFAULT', 'cache_dir'))
+ log.msg('now avaliable at %s: %s' % (urlpath, url))