All pastes #89022 Raw Edit

Someone

public python v1 · immutable
#89022 ·published 2006-07-15 17:47 UTC
rendered paste body
    def get_taglist(self):        """Returns a list of active tags and updates cache."""        folders = self.load_from_cache()        # update with new files        new_tags = self.get_new_tags()        if new_tags:            for folder, matches in new_tags.iteritems():                new_tags.setdefault(folder, []).extend(matches)            self.save_to_cache(folders)        items = folders.items()        items.sort()        result = []        for path, matches in items:            folder = Folder(self.env, path)            tmp = {}            for match in matches:                if not match['path'] in tmp:                    f = tmp[match['path']] = File(self.env, match['path'])                else:                    f = tmp[match['path']]                f.tags.append(Tag(self.env, match['tag'], match['text'],                                  match['line']))            for f in tmp.itervalues():                f.tags.sort()                folder.files.append(f)            folder.files.sort()            result.append(folder)        result.sort()        return result