예제 #1
0
 def to_dict(self):
     from chroma_core.lib.util import time_str
     return {
         'alert_severity':
         'alert',  # FIXME: Still need to figure out weather to pass enum or display string.
         'alert_item':
         str(self.alert_item),
         'alert_message':
         self.message(),
         'message':
         self.message(),
         'active':
         bool(self.active),
         'begin':
         time_str(self.begin),
         'end':
         time_str(self.end)
         if self.end is not None else time_str(self.begin),
         'id':
         self.id,
         'alert_item_id':
         self.alert_item_id,
         'alert_item_content_type_id':
         self.alert_item_type_id
     }
예제 #2
0
    def to_dict(self):
        from chroma_core.lib.util import time_str

        return {
            "alert_severity":
            "alert",  # FIXME: Still need to figure out weather to pass enum or display string.
            "alert_item":
            str(self.alert_item),
            "alert_message":
            self.message(),
            "message":
            self.message(),
            "active":
            bool(self.active),
            "begin":
            time_str(self.begin),
            "end":
            time_str(self.end)
            if self.end is not None else time_str(self.begin),
            "id":
            self.id,
            "alert_item_id":
            self.alert_item_id,
            "alert_item_content_type_id":
            self.alert_item_type_id,
        }