Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

urllib2 CacheFTPHandler doesn't work on multiple dirs #39633

Closed
jjlee mannequin opened this issue Nov 30, 2003 · 9 comments
Closed

urllib2 CacheFTPHandler doesn't work on multiple dirs #39633

jjlee mannequin opened this issue Nov 30, 2003 · 9 comments
Assignees
Labels
stdlib Python modules in the Lib dir

Comments

@jjlee
Copy link
Mannequin

jjlee mannequin commented Nov 30, 2003

BPO 851736
Nosy @mhammond, @theller
Files
  • cache_ftp.patch
  • cache_ftp_test.py
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/mhammond'
    closed_at = <Date 2004-05-10.07:38:05.000>
    created_at = <Date 2003-11-30.21:51:02.000>
    labels = ['library']
    title = "urllib2 CacheFTPHandler doesn't work on multiple dirs"
    updated_at = <Date 2004-05-10.07:38:05.000>
    user = 'https://bugs.python.org/jjlee'

    bugs.python.org fields:

    activity = <Date 2004-05-10.07:38:05.000>
    actor = 'mhammond'
    assignee = 'mhammond'
    closed = True
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2003-11-30.21:51:02.000>
    creator = 'jjlee'
    dependencies = []
    files = ['5715', '5716']
    hgrepos = []
    issue_num = 851736
    keywords = ['patch']
    message_count = 9.0
    messages = ['44969', '44970', '44971', '44972', '44973', '44974', '44975', '44976', '44977']
    nosy_count = 3.0
    nosy_names = ['mhammond', 'theller', 'jjlee']
    pr_nums = []
    priority = 'high'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue851736'
    versions = []

    @jjlee
    Copy link
    Mannequin Author

    jjlee mannequin commented Nov 30, 2003

    This is a fix for bug 738973.

    Where are functional tests supposed to go? Is the
    __name__ == "__main__" block the official place? The
    urllib2 functional tests are quite out of date, thanks to
    shifting URLs, so I'd like to fix them, but need to know
    where to do it.

    @jjlee jjlee mannequin closed this as completed Nov 30, 2003
    @jjlee jjlee mannequin assigned mhammond Nov 30, 2003
    @jjlee jjlee mannequin added the stdlib Python modules in the Lib dir label Nov 30, 2003
    @jjlee
    Copy link
    Mannequin Author

    jjlee mannequin commented Nov 30, 2003

    Logged In: YES
    user_id=261020

    @jjlee
    Copy link
    Mannequin Author

    jjlee mannequin commented May 4, 2004

    Logged In: YES
    user_id=261020

    For now at least, should probably just stick the test in the
    if __name__ == "__main__" block of urllib2 without its
    unittest wrapper.

    @mhammond
    Copy link
    Contributor

    mhammond commented May 5, 2004

    Logged In: YES
    user_id=14198

    The password is being dropped from the cache - I can't see
    how this could possibly hurt though. This all looks
    reasonable to me, and fails (then works) as described. I
    will check this in in a couple of days to make sure noone
    objects. I won't check the test code in though - ideally,
    it should go in the main test directory, but only if the
    'network' resource is enabled - but I don't see that as a
    blocking issue.

    @jjlee
    Copy link
    Mannequin Author

    jjlee mannequin commented May 5, 2004

    Logged In: YES
    user_id=261020

    Thanks Mark

    FWIW, the idea of having the test in __main__ is that it's a
    functional test, not a unit test. But when I raised this issue on
    python-dev (thread ends at message whose URL is below), I
    left more confused than when I arrived, so feel free to put them
    where you like ;-)

    http://mail.python.org/pipermail/python-dev/2003-December/040861.html

    @theller
    Copy link

    theller commented May 5, 2004

    Logged In: YES
    user_id=11105

    The problem with test code in the __main__ block is that
    py2exe, for example, concludes that the unittest module is
    needed.

    If that is done, imo it would be better to write the main
    block in this way, so that at least this is compiled away
    with -O or -OO:

    if __name__ == '__main__':
        if __debug__:
            import unittest
            # test code...

    @mhammond
    Copy link
    Contributor

    mhammond commented May 9, 2004

    Logged In: YES
    user_id=14198

    Actually, wouldn't it be better to store 'dirs' directly in
    the dict?

    ie, instead of:
    + key = user, host, port, '/'.join(dirs)

    just do:
    + key = user, host, port, dirs

    Then the only assumption we make is that it is hashable.

    @jjlee
    Copy link
    Mannequin Author

    jjlee mannequin commented May 9, 2004

    Logged In: YES
    user_id=261020

    OK. dirs is a list, though, so it should be:

    + key = user, host, port, tuple(dirs)

    @mhammond
    Copy link
    Contributor

    Logged In: YES
    user_id=14198

    Re the tuple() - I think your original patch is better. I
    haven't done anything with the tests, but I encourage you to
    pursue a patch to the test suite when the network resource
    is enabled, and basically ignore other implications until
    they happen :) These tests would only go in 2.4.

    Fixed on 2.3 branch:
    Checking in urllib2.py;
    new revision: 1.53.6.6; previous revision: 1.53.6.5

    Fixed on trunk:
    new revision: 1.66; previous revision: 1.65

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants