mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 12:42:34 +01:00
Changed ChannelUserDatabase to ChannelUserDB.
This commit is contained in:
parent
18fcfd9335
commit
6072094207
@ -52,7 +52,7 @@ import callbacks
|
||||
|
||||
filename = os.path.join(conf.supybot.directories.data(), 'Herald.db')
|
||||
|
||||
class HeraldDB(plugins.ChannelUserDatabase):
|
||||
class HeraldDB(plugins.ChannelUserDB):
|
||||
def serialize(self, v):
|
||||
return [v]
|
||||
|
||||
|
@ -57,7 +57,7 @@ import privmsgs
|
||||
import registry
|
||||
import callbacks
|
||||
|
||||
class SeenDB(plugins.ChannelUserDatabase):
|
||||
class SeenDB(plugins.ChannelUserDB):
|
||||
def serialize(self, v):
|
||||
return list(v)
|
||||
|
||||
|
@ -187,7 +187,7 @@ class ChannelUserDictionary(UserDict.DictMixin):
|
||||
return L
|
||||
|
||||
|
||||
class ChannelUserDatabase(ChannelUserDictionary):
|
||||
class ChannelUserDB(ChannelUserDictionary):
|
||||
def __init__(self, filename):
|
||||
ChannelUserDictionary.__init__(self)
|
||||
self.filename = filename
|
||||
@ -204,15 +204,21 @@ class ChannelUserDatabase(ChannelUserDictionary):
|
||||
try:
|
||||
channel = t.pop(0)
|
||||
id = t.pop(0)
|
||||
try:
|
||||
id = int(id)
|
||||
except ValueError:
|
||||
# We'll skip over this so, say, nicks can be kept here.
|
||||
pass
|
||||
v = self.deserialize(t)
|
||||
self[channel, id] = v
|
||||
except Exception, e:
|
||||
log.warning('Invalid line #%s in %s.',
|
||||
lineno, self.__class__.__name__)
|
||||
log.debug('Exception: %s', utils.exnToString(e))
|
||||
except Exception, e: # This catches exceptions from csv.reader.
|
||||
log.warning('Invalid line #%s in %s.',
|
||||
lineno, self.__class__.__name__)
|
||||
log.debug('Exception: %s', utils.exnToString(e))
|
||||
|
||||
def flush(self):
|
||||
fd = file(self.filename, 'w')
|
||||
|
Loading…
Reference in New Issue
Block a user