def load(cls, context, db_event=None, event_id=None): '''Retrieve an event record from database.''' if db_event is not None: return cls.from_db_record(db_event) record = db_api.event_get(context, event_id) if record is None: raise exception.EventNotFound(event=event_id) return cls.from_db_record(record)
def load(cls, context, db_event=None, event_id=None, project_safe=True): """Retrieve an event record from database.""" if db_event is not None: return cls.from_db_record(db_event) record = db_api.event_get(context, event_id, project_safe=project_safe) if record is None: raise exception.EventNotFound(event=event_id) return cls.from_db_record(record)
def get(cls, context, event_id, **kwargs): return db_api.event_get(context, event_id, **kwargs)
def get(cls, context, event_id, **kwargs): obj = db_api.event_get(context, event_id, **kwargs) return cls._from_db_object(context, cls(), obj)