Skip to content

Commit

Permalink
Added script to check personnel-folder
Browse files Browse the repository at this point in the history
  • Loading branch information
sgeulette committed Nov 19, 2020
1 parent 1815cf9 commit 163138f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Extensions/corrections.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,3 +417,22 @@ def dv_clean(self, days_back='365', date_back=None, batch='3000'):
"Objects: '{obj}', Files: '{files}', Pages: '{pages}', Deleted: '{deleted}', Size: '{size}'".format(**total),
pghandler)
return '\n'.join(out)


def check_personnel_folder(self):
""" check personnel-folder content to find missing or duplicated information """
if not check_zope_admin():
return "You must be a zope manager to run this script"
out = []
if self.id != 'personnel-folder':
return 'You must be on personnel-folder'
userids = {}
for pers in self.objectValues():
if not pers.userid:
out.append('empty userid: {}'.format(object_link(pers)))
elif pers.userid in userids:
out.append("duplicated userid '{}' : {} and {}".format(pers.userid, object_link(userids[pers.userid]),
object_link(pers)))
else:
userids[pers.userid] = pers
return '\n'.join(out)

0 comments on commit 163138f

Please sign in to comment.