def get_event_types(self):

        if not hasattr(self, "event_types"):

            event_types = {}
            table = current.s3db.dvr_case_event_type

            query = (table.deleted != True)

            sr = current.auth.get_system_roles()
            roles = current.session.s3.roles
            if sr.ADMIN not in roles:
                query &= (table.role_required == None) | \
                         (table.role_required.belongs(roles))

            rows = current.db(query).select(table.id,
                                            table.code,
                                            table.name,
                                            table.is_default,
                                            table.comments,
                                            )
            for row in rows:
                event_types[row.id] = row
                if row.is_default:
                    event_types["_default"] = row
            self.event_types = event_types

        return self.event_types

    # -------------------------------------------------------------------------
    # Common methods
    # -------------------------------------------------------------------------
Lazy getter for case event types
dataset/ETHPy150Open sahana/eden/modules/s3db/dvr.py/DVRRegisterCaseEvent.get_event_types