def get_person_by_desktop_login(desktop_login): """ Return person that matches given desktop login as a dictionary. It is useful to authenticate user from their desktop session login. """ try: person = Person.get_by(desktop_login=desktop_login) except StatementError: raise PersonNotFoundException() if person is None: raise PersonNotFoundException() return person.serialize()
def get_person_raw(person_id): """ Return given person as an active record. """ if person_id is None: raise PersonNotFoundException() try: person = Person.get(person_id) except StatementError: raise PersonNotFoundException() if person is None: raise PersonNotFoundException() return person
def get_contact_raw(contact_id): """ Return given person as an active record. """ if contact_id is None: raise PersonNotFoundException() try: contact = Contact.get(contact_id) except StatementError: raise PersonNotFoundException() if contact is None: raise PersonNotFoundException() return contact
def get_person_by_email_raw(email): """ Return person that matches given email as an active record. """ person = Person.get_by(email=email) if person is None: raise PersonNotFoundException() return person
def get_contact_by_email_raw(email): """ Return person that matches given email as an active record. """ contact = Contact.get_by(email=email) if contact is None: raise PersonNotFoundException() return contact