def get_emails(self):
"""Returns the emails from all registered lab managers
"""
query = {"portal_type": ["Contact", "LabContact"]}
contacts = map(api.get_object, api.search(query, "portal_catalog"))
lab_manager_emails = []
for contact in contacts:
roles = contact.getRoles()
if "LabManager" in roles:
email = contact.getEmailAddress()
if email:
lab_manager_emails.append(email)
print(lab_manager_emails)
return list(OrderedDict.fromkeys(lab_manager_emails))
Is this code Correct for getting Lab manager Email From Lab Contacts?