author | Tero Marttila <terom@fixme.fi> |
Wed, 11 Feb 2009 22:24:55 +0200 | |
changeset 111 | 95c0c49d76aa |
parent 73 | 5a7188bf2894 |
permissions | -rw-r--r-- |
41 | 1 |
""" |
2 |
Our list of LogChannels |
|
3 |
""" |
|
4 |
||
5 |
class ChannelList (object) : |
|
6 |
""" |
|
7 |
The list of channels, and related methods |
|
8 |
""" |
|
50
f13cf27a360b
implement more LogSource features (logs for date, cleanup last_logs), implement irssi parser, formatter, other misc. stuff
Tero Marttila <terom@fixme.fi>
parents:
46
diff
changeset
|
9 |
|
f13cf27a360b
implement more LogSource features (logs for date, cleanup last_logs), implement irssi parser, formatter, other misc. stuff
Tero Marttila <terom@fixme.fi>
parents:
46
diff
changeset
|
10 |
|
73
5a7188bf2894
split defined configuration constants into config, and implement search result pagination
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
11 |
def __init__ (self, channel_list) : |
41 | 12 |
""" |
13 |
Initialize with the given channel dict |
|
14 |
""" |
|
73
5a7188bf2894
split defined configuration constants into config, and implement search result pagination
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
15 |
|
5a7188bf2894
split defined configuration constants into config, and implement search result pagination
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
16 |
self.channel_list = channel_list |
5a7188bf2894
split defined configuration constants into config, and implement search result pagination
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
17 |
self.channel_dict = dict((channel.id, channel) for channel in channel_list) |
41 | 18 |
|
19 |
def lookup (self, channel_name) : |
|
20 |
""" |
|
21 |
Looks up the LogChannel for the given name |
|
22 |
""" |
|
23 |
||
73
5a7188bf2894
split defined configuration constants into config, and implement search result pagination
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
24 |
return self.channel_dict[channel_name] |
51
07ca28f3a9f2
use improved URLConfig/URLType
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
25 |
|
07ca28f3a9f2
use improved URLConfig/URLType
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
26 |
def dict (self) : |
07ca28f3a9f2
use improved URLConfig/URLType
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
27 |
""" |
07ca28f3a9f2
use improved URLConfig/URLType
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
28 |
Returns a { name: LogChannel } dict |
07ca28f3a9f2
use improved URLConfig/URLType
Tero Marttila <terom@fixme.fi>
parents:
50
diff
changeset
|
29 |
""" |
73
5a7188bf2894
split defined configuration constants into config, and implement search result pagination
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
30 |
return self.channel_dict |
41 | 31 |
|
32 |
def __iter__ (self) : |
|
33 |
""" |
|
34 |
Iterate over our defined LogChannel objects |
|
35 |
""" |
|
36 |
||
73
5a7188bf2894
split defined configuration constants into config, and implement search result pagination
Tero Marttila <terom@fixme.fi>
parents:
51
diff
changeset
|
37 |
return iter(self.channel_list) |
41 | 38 |