mirror of
				https://github.com/Mikaela/Limnoria.git
				synced 2025-11-04 09:37:25 +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.registerGroup(conf.supybot.plugins.Alias, 'aliases')
 | 
			
		||||
filename = os.path.join(conf.supybot.directories.conf(), 'aliases.conf')
 | 
			
		||||
class Alias(callbacks.Privmsg):
 | 
			
		||||
    def __init__(self):
 | 
			
		||||
        callbacks.Privmsg.__init__(self)
 | 
			
		||||
 | 
			
		||||
@ -168,8 +168,7 @@ class ChannelLogger(callbacks.Privmsg):
 | 
			
		||||
            return '%s.log' % channel
 | 
			
		||||
 | 
			
		||||
    def getLogDir(self, irc, channel):
 | 
			
		||||
        logDir = conf.supybot.directories.log()
 | 
			
		||||
        logDir = os.path.join(logDir, self.name())
 | 
			
		||||
        logDir = conf.supybot.directories.log.dirize(self.name())
 | 
			
		||||
        if self.registryValue('directories'):
 | 
			
		||||
            if self.registryValue('directories.network'):
 | 
			
		||||
                logDir = os.path.join(logDir,  irc.network)
 | 
			
		||||
 | 
			
		||||
@ -192,6 +192,7 @@ class StatsDB(plugins.ChannelUserDB):
 | 
			
		||||
    def getUserStats(self, channel, id):
 | 
			
		||||
        return self[channel, id]
 | 
			
		||||
 | 
			
		||||
filename = conf.supybot.directories.data.dirize('ChannelStats.db')
 | 
			
		||||
class ChannelStats(callbacks.Privmsg):
 | 
			
		||||
    noIgnore = True
 | 
			
		||||
    def __init__(self):
 | 
			
		||||
@ -199,15 +200,12 @@ class ChannelStats(callbacks.Privmsg):
 | 
			
		||||
        self.lastmsg = None
 | 
			
		||||
        self.laststate = None
 | 
			
		||||
        self.outFiltering = False
 | 
			
		||||
        self.db = StatsDB(os.path.join(conf.supybot.directories.data(),
 | 
			
		||||
                                       'ChannelStats.db'))
 | 
			
		||||
        world.flushers.append(self.db.flush)
 | 
			
		||||
        self.db = StatsDB(filename)
 | 
			
		||||
        self._flush = self.db.flush
 | 
			
		||||
        world.flushers.append(self._flush)
 | 
			
		||||
 | 
			
		||||
    def die(self):
 | 
			
		||||
        if self.db.flush in world.flushers:
 | 
			
		||||
            world.flushers.remove(self.db.flush)
 | 
			
		||||
        else:
 | 
			
		||||
            self.log.debug('Odd, no flush in flushers: %r', world.flushers)
 | 
			
		||||
        world.flushers.remove(self._flush)
 | 
			
		||||
        self.db.close()
 | 
			
		||||
        callbacks.Privmsg.die(self)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -102,7 +102,7 @@ class Debian(callbacks.Privmsg,
 | 
			
		||||
                             'debian/dists/unstable/Contents-i386.gz',
 | 
			
		||||
                             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):
 | 
			
		||||
        callbacks.Privmsg.__init__(self)
 | 
			
		||||
        plugins.PeriodicFileDownloader.__init__(self)
 | 
			
		||||
 | 
			
		||||
@ -50,7 +50,7 @@ import supybot.ircutils as ircutils
 | 
			
		||||
import supybot.registry as registry
 | 
			
		||||
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):
 | 
			
		||||
    def serialize(self, v):
 | 
			
		||||
 | 
			
		||||
@ -312,8 +312,7 @@ class Lookup(callbacks.Privmsg):
 | 
			
		||||
        group.unregister(name)
 | 
			
		||||
 | 
			
		||||
    def addDatabase(self, name, filename):
 | 
			
		||||
        dataDir = conf.supybot.directories.data()
 | 
			
		||||
        filename = os.path.join(dataDir, filename)
 | 
			
		||||
        filename = conf.supybot.directories.data.dirize(filename)
 | 
			
		||||
        fd = file(filename)
 | 
			
		||||
        self.db.addLookup(name, fd, self._splitRe)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -45,10 +45,14 @@ import supybot.irclib as irclib
 | 
			
		||||
###
 | 
			
		||||
class RawLogger(irclib.IrcCallback):
 | 
			
		||||
    def __init__(self):
 | 
			
		||||
        logDir = conf.supybot.directories.log()
 | 
			
		||||
        self.fd = file(os.path.join(logDir, 'raw.log'), 'a')
 | 
			
		||||
        world.flushers.append(self.fd.flush)
 | 
			
		||||
        self.fd = file(conf.supybot.directories.log.dirize('raw.log'), 'a')
 | 
			
		||||
        self._flush = self.fd.flush
 | 
			
		||||
        world.flushers.append(self._flush)
 | 
			
		||||
 | 
			
		||||
    def die(self):
 | 
			
		||||
        world.flushers.remove(self._flush)
 | 
			
		||||
        self.fd.close()
 | 
			
		||||
        
 | 
			
		||||
    def inFilter(self, irc, msg):
 | 
			
		||||
        self.fd.write(str(msg))
 | 
			
		||||
        return msg
 | 
			
		||||
 | 
			
		||||
@ -76,11 +76,12 @@ class TodoDB(plugins.DBHandler):
 | 
			
		||||
        return db
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
filename = conf.supybot.directories.data.dirize('Todo.db')
 | 
			
		||||
class Todo(callbacks.Privmsg):
 | 
			
		||||
    def __init__(self):
 | 
			
		||||
        callbacks.Privmsg.__init__(self)
 | 
			
		||||
        dataDir = conf.supybot.directories.data()
 | 
			
		||||
        self.dbHandler = TodoDB(os.path.join(dataDir, 'Todo'))
 | 
			
		||||
        self.dbHandler = TodoDB(filename)
 | 
			
		||||
 | 
			
		||||
    def die(self):
 | 
			
		||||
        self.dbHandler.die()
 | 
			
		||||
 | 
			
		||||
@ -172,7 +172,7 @@ class WordStatsDB(plugins.ChannelUserDB):
 | 
			
		||||
                    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):
 | 
			
		||||
    noIgnore = True
 | 
			
		||||
    def __init__(self):
 | 
			
		||||
@ -180,11 +180,11 @@ class WordStats(callbacks.Privmsg):
 | 
			
		||||
        self.__parent.__init__()
 | 
			
		||||
        self.db = WordStatsDB(filename)
 | 
			
		||||
        self.queried = False
 | 
			
		||||
        world.flushers.append(self.db.flush)
 | 
			
		||||
        self._flush = self.db.flush
 | 
			
		||||
        world.flushers.append(self._flush)
 | 
			
		||||
 | 
			
		||||
    def die(self):
 | 
			
		||||
        if self.db.flush in world.flushers:
 | 
			
		||||
            world.flushers.remove(self.db.flush)
 | 
			
		||||
        world.flushers.remove(self._flush)
 | 
			
		||||
        self.db.close()
 | 
			
		||||
        self.__parent.die()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -69,18 +69,13 @@ def configure(advanced):
 | 
			
		||||
class XMLLogger(callbacks.Privmsg):
 | 
			
		||||
    def __init__(self):
 | 
			
		||||
        callbacks.Privmsg.__init__(self)
 | 
			
		||||
        logDir = conf.supybot.directories.log()
 | 
			
		||||
        self.fd = file(os.path.join(logDir, 'xml.log'), 'a')
 | 
			
		||||
        self.boundFlushMethod = self.fd.flush
 | 
			
		||||
        world.flushers.append(self.boundFlushMethod)
 | 
			
		||||
        filename = conf.supybot.directories.log.dirize('xml.log')
 | 
			
		||||
        self.fd = file(filename, 'a')
 | 
			
		||||
        self._flush = self.fd.flush
 | 
			
		||||
        world.flushers.append(self._flush)
 | 
			
		||||
 | 
			
		||||
    def die(self):
 | 
			
		||||
        if self.boundFlushMethod in world.flushers:
 | 
			
		||||
            world.flushers.remove(self.boundFlushMethod)
 | 
			
		||||
        else:
 | 
			
		||||
            if not world.dying:
 | 
			
		||||
                self.log.warning('My flusher wasn\'t in world.flushers: %r',
 | 
			
		||||
                                 world.flushers)
 | 
			
		||||
        world.flushers.remove(self._flush)
 | 
			
		||||
        self.fd.close()
 | 
			
		||||
 | 
			
		||||
    def writeMsg(self, msg):
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user