-
Notifications
You must be signed in to change notification settings - Fork 16
/
notifications.py
73 lines (53 loc) · 1.6 KB
/
notifications.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
from portality.dao import DomainObject
from portality.lib import dates
class Notification(DomainObject):
"""~~Notification:Model->DomainObject:Model~~"""
__type__ = "notification"
def __init__(self, **kwargs):
super(Notification, self).__init__(**kwargs)
@property
def who(self):
return self.data.get("who")
@who.setter
def who(self, account_id):
self.data["who"] = account_id
@property
def short(self):
return self.data.get("short")
@short.setter
def short(self, message):
self.data["short"] = message
@property
def long(self):
return self.data.get("long")
@long.setter
def long(self, message):
self.data["long"] = message
@property
def seen_date(self):
return self.data.get("seen_date")
@seen_date.setter
def seen_date(self, date):
self.data["seen_date"] = date
def is_seen(self):
return "seen_date" in self.data
def set_seen(self):
self.seen_date = dates.now_str()
@property
def action(self):
return self.data.get("action")
@action.setter
def action(self, action_url):
self.data["action"] = action_url
@property
def classification(self):
return self.data.get("classification")
@classification.setter
def classification(self, classification):
self.data["classification"] = classification
@property
def created_by(self):
return self.data.get("created_by")
@created_by.setter
def created_by(self, consumer_id):
self.data["created_by"] = consumer_id