25 lines
No EOL
707 B
Python
25 lines
No EOL
707 B
Python
from globalmessages_models_interface import GlobalMessageDataInterface, GlobalMessage
|
|
from data import model
|
|
|
|
|
|
class GlobalMessagePreOCI(GlobalMessageDataInterface):
|
|
|
|
def get_all_messages(self):
|
|
messages = model.message.get_messages()
|
|
return [self._message(m) for m in messages]
|
|
|
|
def create_message(self, content):
|
|
model.message.create([content])
|
|
|
|
def delete_message(self, uuid):
|
|
model.message.delete_message([uuid])
|
|
|
|
def _message(self, message_obj):
|
|
return GlobalMessage(
|
|
uuid=message_obj.uuid,
|
|
content=message_obj.content,
|
|
severity=message_obj.severity,
|
|
media_type_name=message_obj.media_type.name,
|
|
)
|
|
|
|
pre_oci_model = GlobalMessagePreOCI() |