def __init__(self, parent, actions, trows, crows): UnorderedList.__init__(self) self._actiondata = {} for a in actions: self._actiondata[a.actionid] = a self.actions = {} for row in trows: element = UnorderedList() #li = ListItem('action-%d' % row.actionid) li = ActionItem(self._actiondata[row.actionid]) element.appendChild(li) self.actions[row.actionid] = element self.appendChild(element) self.make_threads(parent, crows)
def make_threads(self, parent, rows): while len(rows): row = rows[0] element = UnorderedList() #element = ListItem('actionid %d' % row.actionid) if not row.parent: parent.appendChild(element) #element.appendChild(ListItem('actionid--%d' % row.actionid)) elif not self.actions.has_key(row.parent): rows.append(row) else: self.actions[row.parent].appendChild(element) element.appendChild(ActionItem(self._actiondata[row.actionid])) self.actions[row.actionid] = element del rows[0]