Skip to content

Commit

Permalink
fix handling empty lists for used and unused versions (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
4nn0 authored and ggatward committed Feb 20, 2018
1 parent 89ea6ec commit e0de840
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions clean_content_views.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,18 @@ def cleanup(ver_list, ver_descr, dry_run, runuser, ver_keep, cleanall, ignorefir
version_list.append(float(version['version']))

# Find the oldest 'in use' version id
lastver = min(version_list)
msg = "Oldest in-use version is " + str(lastver)
if not version_list:
msg = "No oldest in-use version found"
else:
lastver = min(version_list)
msg = "Oldest in-use version is " + str(lastver)
helpers.log_msg(msg, 'DEBUG')

# Find the oldest 'NOT in use' version id
msg = "Oldest NOT-in-use version is " + str(min(version_list_all))
if not version_list_all:
msg = "No oldest NOT-in-use version found"
else:
msg = "Oldest NOT-in-use version is " + str(min(version_list_all))
helpers.log_msg(msg, 'DEBUG')

# Find version to delete (based on keep parameter) if --ignorefirstpromoted
Expand Down

0 comments on commit e0de840

Please sign in to comment.