Coverage for portality/models/notifications.py: 100%

52 statements  

« prev     ^ index     » next       coverage.py v6.4.2, created at 2022-07-22 15:59 +0100

1from portality.dao import DomainObject 

2from portality.lib import dates 

3 

4 

5class Notification(DomainObject): 

6 """~~Notification:Model->DomainObject:Model~~""" 

7 __type__ = "notification" 

8 

9 def __init__(self, **kwargs): 

10 super(Notification, self).__init__(**kwargs) 

11 

12 @property 

13 def who(self): 

14 return self.data.get("who") 

15 

16 @who.setter 

17 def who(self, account_id): 

18 self.data["who"] = account_id 

19 

20 @property 

21 def short(self): 

22 return self.data.get("short") 

23 

24 @short.setter 

25 def short(self, message): 

26 self.data["short"] = message 

27 

28 @property 

29 def long(self): 

30 return self.data.get("long") 

31 

32 @long.setter 

33 def long(self, message): 

34 self.data["long"] = message 

35 

36 @property 

37 def seen_date(self): 

38 return self.data.get("seen_date") 

39 

40 @seen_date.setter 

41 def seen_date(self, date): 

42 self.data["seen_date"] = date 

43 

44 def is_seen(self): 

45 return "seen_date" in self.data 

46 

47 def set_seen(self): 

48 self.seen_date = dates.now() 

49 

50 @property 

51 def action(self): 

52 return self.data.get("action") 

53 

54 @action.setter 

55 def action(self, action_url): 

56 self.data["action"] = action_url 

57 

58 @property 

59 def classification(self): 

60 return self.data.get("classification") 

61 

62 @classification.setter 

63 def classification(self, classification): 

64 self.data["classification"] = classification 

65 

66 @property 

67 def created_by(self): 

68 return self.data.get("created_by") 

69 

70 @created_by.setter 

71 def created_by(self, consumer_id): 

72 self.data["created_by"] = consumer_id 

73