comparison src/tools/common/data_objects.py @ 2228:cf6c539672c7

tools (common/data_objects): comments items can now be chained to their parent
author Goffi <goffi@goffi.org>
date Mon, 17 Apr 2017 20:34:43 +0200
parents e67e8cd24141
children 0ffa8ba0857c
comparison
equal deleted inserted replaced
2227:79d279d1ee88 2228:cf6c539672c7
31 def __init__(self, mb_data): 31 def __init__(self, mb_data):
32 self.mb_data = mb_data 32 self.mb_data = mb_data
33 self._tags = None 33 self._tags = None
34 self._groups = None 34 self._groups = None
35 self._comments = None 35 self._comments = None
36 self._comments_items_list = None
36 37
37 @property 38 @property
38 def id(self): 39 def id(self):
39 return self.mb_data.get(u'id') 40 return self.mb_data.get(u'id')
40 41
112 113
113 @property 114 @property
114 def comments_node(self): 115 def comments_node(self):
115 return self.mb_data.get(u'comments_node') 116 return self.mb_data.get(u'comments_node')
116 117
118 @property
119 def comments_items_list(self):
120 return [] if self._comments_items_list is None else self._comments_items_list
121
122 def appendCommentsItems(self, items):
123 """append comments items to self.comments_items"""
124 if self._comments_items_list is None:
125 self._comments_items_list = []
126 self._comments_items_list.append(items)
127
117 128
118 class BlogItems(object): 129 class BlogItems(object):
119 130
120 def __init__(self, mb_data): 131 def __init__(self, mb_data):
121 self.mb_data = mb_data 132 self.mb_data = mb_data