Show More
@@ -205,14 +205,21 b' class unbundlerecords(object):' | |||||
205 | def __init__(self): |
|
205 | def __init__(self): | |
206 | self._categories = {} |
|
206 | self._categories = {} | |
207 | self._sequences = [] |
|
207 | self._sequences = [] | |
|
208 | self._replies = {} | |||
208 |
|
209 | |||
209 | def add(self, category, entry): |
|
210 | def add(self, category, entry, inreplyto=None): | |
210 | """add a new record of a given category. |
|
211 | """add a new record of a given category. | |
211 |
|
212 | |||
212 | The entry can then be retrieved in the list returned by |
|
213 | The entry can then be retrieved in the list returned by | |
213 | self['category'].""" |
|
214 | self['category'].""" | |
214 | self._categories.setdefault(category, []).append(entry) |
|
215 | self._categories.setdefault(category, []).append(entry) | |
215 | self._sequences.append((category, entry)) |
|
216 | self._sequences.append((category, entry)) | |
|
217 | if inreplyto is not None: | |||
|
218 | self.getreplies(inreplyto).add(category, entry) | |||
|
219 | ||||
|
220 | def getreplies(self, partid): | |||
|
221 | """get the subrecords that replies to a specific part""" | |||
|
222 | return self._replies.setdefault(partid, unbundlerecords()) | |||
216 |
|
223 | |||
217 | def __getitem__(self, cat): |
|
224 | def __getitem__(self, cat): | |
218 | return tuple(self._categories.get(cat, ())) |
|
225 | return tuple(self._categories.get(cat, ())) |
General Comments 0
You need to be logged in to leave comments.
Login now