mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Todo #1047143, conversion of os.path.join calls to dirize calls.
This commit is contained in:
parent
eb03f94f07
commit
161b9b96fc
@ -151,7 +151,6 @@ def makeNewAlias(name, alias):
|
|||||||
|
|
||||||
conf.registerPlugin('Alias')
|
conf.registerPlugin('Alias')
|
||||||
conf.registerGroup(conf.supybot.plugins.Alias, 'aliases')
|
conf.registerGroup(conf.supybot.plugins.Alias, 'aliases')
|
||||||
filename = os.path.join(conf.supybot.directories.conf(), 'aliases.conf')
|
|
||||||
class Alias(callbacks.Privmsg):
|
class Alias(callbacks.Privmsg):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
callbacks.Privmsg.__init__(self)
|
callbacks.Privmsg.__init__(self)
|
||||||
|
@ -168,8 +168,7 @@ class ChannelLogger(callbacks.Privmsg):
|
|||||||
return '%s.log' % channel
|
return '%s.log' % channel
|
||||||
|
|
||||||
def getLogDir(self, irc, channel):
|
def getLogDir(self, irc, channel):
|
||||||
logDir = conf.supybot.directories.log()
|
logDir = conf.supybot.directories.log.dirize(self.name())
|
||||||
logDir = os.path.join(logDir, self.name())
|
|
||||||
if self.registryValue('directories'):
|
if self.registryValue('directories'):
|
||||||
if self.registryValue('directories.network'):
|
if self.registryValue('directories.network'):
|
||||||
logDir = os.path.join(logDir, irc.network)
|
logDir = os.path.join(logDir, irc.network)
|
||||||
|
@ -192,6 +192,7 @@ class StatsDB(plugins.ChannelUserDB):
|
|||||||
def getUserStats(self, channel, id):
|
def getUserStats(self, channel, id):
|
||||||
return self[channel, id]
|
return self[channel, id]
|
||||||
|
|
||||||
|
filename = conf.supybot.directories.data.dirize('ChannelStats.db')
|
||||||
class ChannelStats(callbacks.Privmsg):
|
class ChannelStats(callbacks.Privmsg):
|
||||||
noIgnore = True
|
noIgnore = True
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -199,15 +200,12 @@ class ChannelStats(callbacks.Privmsg):
|
|||||||
self.lastmsg = None
|
self.lastmsg = None
|
||||||
self.laststate = None
|
self.laststate = None
|
||||||
self.outFiltering = False
|
self.outFiltering = False
|
||||||
self.db = StatsDB(os.path.join(conf.supybot.directories.data(),
|
self.db = StatsDB(filename)
|
||||||
'ChannelStats.db'))
|
self._flush = self.db.flush
|
||||||
world.flushers.append(self.db.flush)
|
world.flushers.append(self._flush)
|
||||||
|
|
||||||
def die(self):
|
def die(self):
|
||||||
if self.db.flush in world.flushers:
|
world.flushers.remove(self._flush)
|
||||||
world.flushers.remove(self.db.flush)
|
|
||||||
else:
|
|
||||||
self.log.debug('Odd, no flush in flushers: %r', world.flushers)
|
|
||||||
self.db.close()
|
self.db.close()
|
||||||
callbacks.Privmsg.die(self)
|
callbacks.Privmsg.die(self)
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ class Debian(callbacks.Privmsg,
|
|||||||
'debian/dists/unstable/Contents-i386.gz',
|
'debian/dists/unstable/Contents-i386.gz',
|
||||||
604800, None)
|
604800, None)
|
||||||
}
|
}
|
||||||
contents = os.path.join(conf.supybot.directories.data(),'Contents-i386.gz')
|
contents = conf.supybot.directories.data.dirize('Contents-i386.gz')
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
callbacks.Privmsg.__init__(self)
|
callbacks.Privmsg.__init__(self)
|
||||||
plugins.PeriodicFileDownloader.__init__(self)
|
plugins.PeriodicFileDownloader.__init__(self)
|
||||||
|
@ -50,7 +50,7 @@ import supybot.ircutils as ircutils
|
|||||||
import supybot.registry as registry
|
import supybot.registry as registry
|
||||||
import supybot.callbacks as callbacks
|
import supybot.callbacks as callbacks
|
||||||
|
|
||||||
filename = os.path.join(conf.supybot.directories.data(), 'Herald.db')
|
filename = conf.supybot.directories.data.dirize('Herald.db')
|
||||||
|
|
||||||
class HeraldDB(plugins.ChannelUserDB):
|
class HeraldDB(plugins.ChannelUserDB):
|
||||||
def serialize(self, v):
|
def serialize(self, v):
|
||||||
|
@ -312,8 +312,7 @@ class Lookup(callbacks.Privmsg):
|
|||||||
group.unregister(name)
|
group.unregister(name)
|
||||||
|
|
||||||
def addDatabase(self, name, filename):
|
def addDatabase(self, name, filename):
|
||||||
dataDir = conf.supybot.directories.data()
|
filename = conf.supybot.directories.data.dirize(filename)
|
||||||
filename = os.path.join(dataDir, filename)
|
|
||||||
fd = file(filename)
|
fd = file(filename)
|
||||||
self.db.addLookup(name, fd, self._splitRe)
|
self.db.addLookup(name, fd, self._splitRe)
|
||||||
|
|
||||||
|
@ -45,9 +45,13 @@ import supybot.irclib as irclib
|
|||||||
###
|
###
|
||||||
class RawLogger(irclib.IrcCallback):
|
class RawLogger(irclib.IrcCallback):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
logDir = conf.supybot.directories.log()
|
self.fd = file(conf.supybot.directories.log.dirize('raw.log'), 'a')
|
||||||
self.fd = file(os.path.join(logDir, 'raw.log'), 'a')
|
self._flush = self.fd.flush
|
||||||
world.flushers.append(self.fd.flush)
|
world.flushers.append(self._flush)
|
||||||
|
|
||||||
|
def die(self):
|
||||||
|
world.flushers.remove(self._flush)
|
||||||
|
self.fd.close()
|
||||||
|
|
||||||
def inFilter(self, irc, msg):
|
def inFilter(self, irc, msg):
|
||||||
self.fd.write(str(msg))
|
self.fd.write(str(msg))
|
||||||
|
@ -76,11 +76,12 @@ class TodoDB(plugins.DBHandler):
|
|||||||
return db
|
return db
|
||||||
|
|
||||||
|
|
||||||
|
filename = conf.supybot.directories.data.dirize('Todo.db')
|
||||||
class Todo(callbacks.Privmsg):
|
class Todo(callbacks.Privmsg):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
callbacks.Privmsg.__init__(self)
|
callbacks.Privmsg.__init__(self)
|
||||||
dataDir = conf.supybot.directories.data()
|
dataDir = conf.supybot.directories.data()
|
||||||
self.dbHandler = TodoDB(os.path.join(dataDir, 'Todo'))
|
self.dbHandler = TodoDB(filename)
|
||||||
|
|
||||||
def die(self):
|
def die(self):
|
||||||
self.dbHandler.die()
|
self.dbHandler.die()
|
||||||
|
@ -172,7 +172,7 @@ class WordStatsDB(plugins.ChannelUserDB):
|
|||||||
self[channel, id][word] += 1
|
self[channel, id][word] += 1
|
||||||
|
|
||||||
|
|
||||||
filename=os.path.join(conf.supybot.directories.data(), 'WordStats.db')
|
filename = conf.supybot.directories.data.dirize('WordStats.db')
|
||||||
class WordStats(callbacks.Privmsg):
|
class WordStats(callbacks.Privmsg):
|
||||||
noIgnore = True
|
noIgnore = True
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -180,11 +180,11 @@ class WordStats(callbacks.Privmsg):
|
|||||||
self.__parent.__init__()
|
self.__parent.__init__()
|
||||||
self.db = WordStatsDB(filename)
|
self.db = WordStatsDB(filename)
|
||||||
self.queried = False
|
self.queried = False
|
||||||
world.flushers.append(self.db.flush)
|
self._flush = self.db.flush
|
||||||
|
world.flushers.append(self._flush)
|
||||||
|
|
||||||
def die(self):
|
def die(self):
|
||||||
if self.db.flush in world.flushers:
|
world.flushers.remove(self._flush)
|
||||||
world.flushers.remove(self.db.flush)
|
|
||||||
self.db.close()
|
self.db.close()
|
||||||
self.__parent.die()
|
self.__parent.die()
|
||||||
|
|
||||||
|
@ -69,18 +69,13 @@ def configure(advanced):
|
|||||||
class XMLLogger(callbacks.Privmsg):
|
class XMLLogger(callbacks.Privmsg):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
callbacks.Privmsg.__init__(self)
|
callbacks.Privmsg.__init__(self)
|
||||||
logDir = conf.supybot.directories.log()
|
filename = conf.supybot.directories.log.dirize('xml.log')
|
||||||
self.fd = file(os.path.join(logDir, 'xml.log'), 'a')
|
self.fd = file(filename, 'a')
|
||||||
self.boundFlushMethod = self.fd.flush
|
self._flush = self.fd.flush
|
||||||
world.flushers.append(self.boundFlushMethod)
|
world.flushers.append(self._flush)
|
||||||
|
|
||||||
def die(self):
|
def die(self):
|
||||||
if self.boundFlushMethod in world.flushers:
|
world.flushers.remove(self._flush)
|
||||||
world.flushers.remove(self.boundFlushMethod)
|
|
||||||
else:
|
|
||||||
if not world.dying:
|
|
||||||
self.log.warning('My flusher wasn\'t in world.flushers: %r',
|
|
||||||
world.flushers)
|
|
||||||
self.fd.close()
|
self.fd.close()
|
||||||
|
|
||||||
def writeMsg(self, msg):
|
def writeMsg(self, msg):
|
||||||
|
Loading…
Reference in New Issue
Block a user