zhuyifei1999 added a comment.

^ is recursion? Instead of

if download_dump(file_temp_storepath, True): 
    # Print file stored
    return
else:
    return False

and recursing inside you could do something like:

return (download_dump(file_temp_storepath, True) or
        download_dump(file_final_storepath, False))

The current looping implementation is like:

filepath = file_temp_storepath
for non_atomic in range(2):
    try:
        #Put download code here
    except (OSError, IOError):
        #Exception/remove stuff
        if not non_atomic:
            # Print error
            filepath = file_final_storepath
        else:
            return False

The implementation in my head is:

filepath = file_temp_storepath
while True:
    try:
        #Put download code here
    except (OSError, IOError):
        #Exception/remove stuff
        if filepath == file_final_storepath:
            return False
        filepath = file_final_storepath
    else:
        return

TASK DETAIL
https://phabricator.wikimedia.org/T183675

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: zhuyifei1999
Cc: gerritbot, Dalba, Ryan10145, Framawiki, Aklapper, Xqt, jayvdb, siebrand, Zoranzoki21, eflyjason, pywikibot-bugs-list, zhuyifei1999, Cpaulf30, Bright1055, Baloch007, Darkminds3113, Toppole69, Lordiis, Adik2382, Mine0901, Jayprakash12345, Th3d3v1ls, Ramalepe, Liugev6, Magul, Tbscho, rafidaslam, MayS, Beeyan, Lewizho99, Mdupont, JJMC89, Maathavan, MtDu, D3r1ck01, Avicennasis, Masti, Alchimista, Rxy
_______________________________________________
pywikibot-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-bugs

Reply via email to