Changeset 1711:766c15f83205
- Timestamp:
- Dec 25, 2018, 10:55:24 PM (2 years ago)
- Branch:
- default
- histedit_source:
- 160218f7e8d5388866cabb8ce12f3d2f32ec82ca,bd2e407ea486f11e94d86b0419db5e02843089e1
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/ftputil.txt
r1698 r1711 458 458 Whether ftputil sees "hidden" files and directories (usually files or 459 459 directories whose names start with a dot) depends on the FTP server 460 configuration. By default, ftputil uses the ``-a`` option in the FTP 461 ``LIST`` command to find hidden files. However, the server may ignore 462 this. 463 464 If using the ``-a`` option leads to problems, for example if an 465 FTP server causes an exception, you may switch off the use of the 466 option:: 460 configuration. By default, ftputil does *not* use the ``-a`` option in 461 the FTP ``LIST`` command to find hidden files. 462 463 To tell the server to list hidden directories and files, set 464 ``FTPHost.use_list_a_option`` to ``True``:: 467 465 468 466 ftp_host = ftputil.FTPHost(server, user, password, account, 469 467 session_factory=ftplib.FTP) 470 ftp_host.use_list_a_option = False 468 ftp_host.use_list_a_option = True 469 470 Caveats: 471 472 - If the server doesn't understand the ``-a`` option at all, the 473 server may interpret ``-a`` as the name of a file or directory, 474 which can result in odd behavior. Therefore, use ``-a`` only if 475 you're sure the server you're talking to supports it. Another 476 approach is to have test code for ``-a`` support and fall back to 477 not using the option. 478 479 - Even if the server knows about the ``-a`` option, the server may 480 be configured to ignore it. 471 481 472 482 ``FTPHost`` attributes and methods -
ftputil/host.py
r1688 r1711 94 94 # `download_if_newer`). 95 95 self.set_time_shift(0.0) 96 # Use `LIST -a` option by default. If this causes problems, 97 # the user can set the attribute to `False`. 98 warnings.warn( 99 "`use_list_a_option` will default to `False` in ftputil 4.x.x", 100 DeprecationWarning, stacklevel=2) 101 self.use_list_a_option = True 96 # Don't use `LIST -a` option by default. If the server doesn't 97 # understand the `-a` option and interprets it as a path, the 98 # results can be surprising. See ticket #110. 99 self.use_list_a_option = False 102 100 103 101 def keep_alive(self): -
test/test_real_ftp.py
r1671 r1711 944 944 # option is used. 945 945 host = self.host 946 assert host.use_list_a_option 946 assert not host.use_list_a_option 947 directory_entries = host.listdir(host.curdir) 948 assert ".hidden" not in directory_entries 949 # Switch on showing of hidden paths. 950 host.use_list_a_option = True 947 951 directory_entries = host.listdir(host.curdir) 948 952 assert ".hidden" in directory_entries 949 host.use_list_a_option = False950 directory_entries = host.listdir(host.curdir)951 assert ".hidden" not in directory_entries952 953 953 954 def _make_objects_to_be_garbage_collected(self):
Note: See TracChangeset
for help on using the changeset viewer.