Mercurial > libervia-backend
comparison sat/plugins/plugin_comp_file_sharing.py @ 3932:7af29260ecb8
core: fix and renamed getLocalPath -> get_local_path:
- renaming is following global methods renaming to use snake_case
- for reasons lost in the mists of time, a `profile` argument was used while checking if
`client` is set is enough, and `client.profile` was escaped but actually not used in the
path.
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 10 Oct 2022 15:23:59 +0200 |
parents | 3ef988734869 |
children | 412b99c29d83 |
comparison
equal
deleted
inserted
replaced
3931:6c5f0fbc519b | 3932:7af29260ecb8 |
---|---|
320 class FileSharingSite(server.Site): | 320 class FileSharingSite(server.Site): |
321 requestFactory = FileSharingRequest | 321 requestFactory = FileSharingRequest |
322 | 322 |
323 def __init__(self, file_sharing): | 323 def __init__(self, file_sharing): |
324 self.file_sharing = file_sharing | 324 self.file_sharing = file_sharing |
325 self.file_tmp_dir = file_sharing.host.getLocalPath( | 325 self.file_tmp_dir = file_sharing.host.get_local_path( |
326 None, C.FILES_TMP_DIR, TMP_BUFFER_DIR, component=True, profile=False | 326 None, C.FILES_TMP_DIR, TMP_BUFFER_DIR, component=True |
327 ) | 327 ) |
328 for old_file in self.file_tmp_dir.iterdir(): | 328 for old_file in self.file_tmp_dir.iterdir(): |
329 log.debug(f"purging old buffer file at {old_file}") | 329 log.debug(f"purging old buffer file at {old_file}") |
330 old_file.unlink() | 330 old_file.unlink() |
331 super().__init__(HTTPFileServer()) | 331 super().__init__(HTTPFileServer()) |
367 "XEP-0329_compGetFilesFromNode_build_directory", | 367 "XEP-0329_compGetFilesFromNode_build_directory", |
368 self._addDirectoryMetadataElts) | 368 self._addDirectoryMetadataElts) |
369 self.host.trigger.add( | 369 self.host.trigger.add( |
370 "XEP-0329_parseResult_directory", | 370 "XEP-0329_parseResult_directory", |
371 self._getDirectoryMetadataElts) | 371 self._getDirectoryMetadataElts) |
372 self.files_path = self.host.getLocalPath(None, C.FILES_DIR, profile=False) | 372 self.files_path = self.host.get_local_path(None, C.FILES_DIR) |
373 self.http_port = int(self.host.memory.getConfig( | 373 self.http_port = int(self.host.memory.getConfig( |
374 'component file-sharing', 'http_upload_port', 8888)) | 374 'component file-sharing', 'http_upload_port', 8888)) |
375 connection_type = self.host.memory.getConfig( | 375 connection_type = self.host.memory.getConfig( |
376 'component file-sharing', 'http_upload_connection_type', 'https') | 376 'component file-sharing', 'http_upload_connection_type', 'https') |
377 if connection_type not in ('http', 'https'): | 377 if connection_type not in ('http', 'https'): |
530 quota=utils.getHumanSize(quota), | 530 quota=utils.getHumanSize(quota), |
531 used_space=utils.getHumanSize(used_space), | 531 used_space=utils.getHumanSize(used_space), |
532 file_size=utils.getHumanSize(file_data['size']) | 532 file_size=utils.getHumanSize(file_data['size']) |
533 ) | 533 ) |
534 ) | 534 ) |
535 file_tmp_dir = self.host.getLocalPath( | 535 file_tmp_dir = self.host.get_local_path( |
536 None, C.FILES_TMP_DIR, peer_jid.userhost(), component=True, profile=False | 536 None, C.FILES_TMP_DIR, peer_jid.userhost(), component=True |
537 ) | 537 ) |
538 file_tmp_path = file_data['file_path'] = files_utils.get_unique_name( | 538 file_tmp_path = file_data['file_path'] = files_utils.get_unique_name( |
539 file_tmp_dir/filename) | 539 file_tmp_dir/filename) |
540 | 540 |
541 transfer_data["finished_d"].addCallback( | 541 transfer_data["finished_d"].addCallback( |