[#7628] ticket:646 Fix agpl duplicates discovery
diff --git a/Allura/allura/scripts/remove_duplicate_troves.py b/Allura/allura/scripts/remove_duplicate_troves.py
index 5249498..7866b2e 100644
--- a/Allura/allura/scripts/remove_duplicate_troves.py
+++ b/Allura/allura/scripts/remove_duplicate_troves.py
@@ -82,10 +82,13 @@
@classmethod
def _find_duplicates(cls):
- # agpl is present twice with different cat_id
- # (update in creation command updated only one of duplicates),
- # so code below will not catch it
- dups = M.TroveCategory.query.find({'shortname': 'agpl'}).all()
+ dups = []
+ agpl = M.TroveCategory.query.find({'shortname': 'agpl'}).all()
+ if len(agpl) > 1:
+ # agpl is present twice with different cat_id
+ # (update in creation command updated only one of duplicates),
+ # so code below will not catch it
+ dups.extend(agpl)
for cat in M.TroveCategory.query.find():
if M.TroveCategory.query.find({
'shortname': cat.shortname,