Changes between Initial Version and Version 1 of Ticket #26297


Ignore:
Timestamp:
Mar 1, 2016, 8:53:21 AM (8 years ago)
Author:
Tim Graham
Comment:

I think something like this would make it more obvious where the exception is expected:

try:
    full_path = self.storage.path(fpath)
except NotImplementedError:
    self.storage.delete(fpath)
else:
    if not os.path.exists(full_path) and os.path.lexists(full_path):
        # Delete broken symlinks
        os.unlink(full_path)
    else:
        self.storage.delete(fpath)

A test is also needed.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #26297

    • Property Easy pickings unset
    • Property Needs tests set
    • Property Triage Stage UnreviewedAccepted
  • Ticket #26297 – Description

    initial v1  
    55
    66
    7 {{{
    8 #!div style="font-size: 80%"
    9 Code highlighting:
    10   {{{#!python
    11                 full_path = self.storage.path(fpath)
    12                 if not os.path.exists(full_path) and os.path.lexists(full_path):
    13                     # Delete broken symlinks
    14                     os.unlink(full_path)
    15                 else:
    16                     self.storage.delete(fpath)
    17   }}}
     7{{{#!python
     8full_path = self.storage.path(fpath)
     9if not os.path.exists(full_path) and os.path.lexists(full_path):
     10    # Delete broken symlinks
     11    os.unlink(full_path)
     12else:
     13    self.storage.delete(fpath)
    1814}}}
    1915
    2016Patch?:
    2117
    22 {{{
    23 #!div style="font-size: 80%"
    24 Code highlighting:
    25   {{{#!python
    26                 try:
    27                     full_path = self.storage.path(fpath)
    28                     if not os.path.exists(full_path) and os.path.lexists(full_path):
    29                         # Delete broken symlinks
    30                         os.unlink(full_path)
    31                     else:
    32                         self.storage.delete(fpath)
    33                 except NotImplementedError:
    34                     self.storage.delete(fpath)
    35   }}}
     18{{{#!python
     19try:
     20    full_path = self.storage.path(fpath)
     21    if not os.path.exists(full_path) and os.path.lexists(full_path):
     22        # Delete broken symlinks
     23        os.unlink(full_path)
     24    else:
     25        self.storage.delete(fpath)
     26except NotImplementedError:
     27    self.storage.delete(fpath)
    3628}}}
Back to Top