aboutsummaryrefslogtreecommitdiff
path: root/interfaces/message.py
blob: bf05befa061ba0c7bc1d4bd4fed5a39dd6bd242e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""Messages sent to the user.
"""

from zope import interface
from zope.interface import Attribute

class IMessage(interface.Interface):
    """Interface for all the user messages.
    """
    content = Attribute("""The text message to log""")
    level = Attribute("""Level of the message, 0 is high level and 10 is the lower""")

class ISocketMessage(interface.Interface):
    """Message to sent to the endpoint."""
    content = Attribute("""Content to send""")

@interface.implementer(IMessage)
class Debug():
    """Send a message with a low level"""

    def __init__(self, message):
        self.content = message
        self.level = 10

@interface.implementer(IMessage)
class Error():
    """Send a message with a high level"""

    def __init__(self, message):
        self.content = message
        self.level = 0