terom@41: """ terom@41: Our list of LogChannels terom@41: """ terom@41: terom@41: class ChannelList (object) : terom@41: """ terom@41: The list of channels, and related methods terom@41: """ terom@50: terom@50: terom@73: def __init__ (self, channel_list) : terom@41: """ terom@41: Initialize with the given channel dict terom@41: """ terom@73: terom@73: self.channel_list = channel_list terom@73: self.channel_dict = dict((channel.id, channel) for channel in channel_list) terom@41: terom@41: def lookup (self, channel_name) : terom@41: """ terom@41: Looks up the LogChannel for the given name terom@41: """ terom@41: terom@73: return self.channel_dict[channel_name] terom@51: terom@51: def dict (self) : terom@51: """ terom@51: Returns a { name: LogChannel } dict terom@51: """ terom@73: return self.channel_dict terom@41: terom@41: def __iter__ (self) : terom@41: """ terom@41: Iterate over our defined LogChannel objects terom@41: """ terom@41: terom@73: return iter(self.channel_list) terom@41: