mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
Updated to allow a dirname, so I can use it later for ChannelLogger.
This commit is contained in:
parent
542a9a8193
commit
3a916b2486
@ -109,20 +109,21 @@ class DBHandler(object):
|
|||||||
self.cachedDb.die()
|
self.cachedDb.die()
|
||||||
del self.cachedDb
|
del self.cachedDb
|
||||||
|
|
||||||
def makeChannelFilename(channel, filename):
|
|
||||||
# XXX We should put channel stuff in its own directory.
|
def makeChannelFilename(channel, filename, dirname=None):
|
||||||
assert filename == os.path.basename(filename), 'We don\'t handle dirs.'
|
assert filename == os.path.basename(filename), 'We don\'t handle dirs.'
|
||||||
channel = ircutils.toLower(channel)
|
channel = ircutils.toLower(channel)
|
||||||
if conf.supybot.databases.plugins.channelSpecific.get(channel)():
|
if conf.supybot.databases.plugins.channelSpecific.get(channel)():
|
||||||
# Should we offer the old #channel-filename naming scheme?
|
if dirname is None:
|
||||||
dir = conf.supybot.directories.data.dirize(channel)
|
dir = conf.supybot.directories.data.dirize(channel)
|
||||||
|
else:
|
||||||
|
dir = os.path.join(dirname, channel)
|
||||||
if not os.path.exists(dir):
|
if not os.path.exists(dir):
|
||||||
os.mkdir(dir)
|
os.makedirs(dir)
|
||||||
return os.path.join(dir, filename)
|
return os.path.join(dir, filename)
|
||||||
else:
|
else:
|
||||||
return conf.supybot.directories.data.dirize(filename)
|
return conf.supybot.directories.data.dirize(filename)
|
||||||
## filename = '%s-%s' % (channel, filename)
|
|
||||||
## return conf.supybot.directories.data.dirize(filename)
|
|
||||||
|
|
||||||
# XXX: This shouldn't be a mixin. This should be contained by classes that
|
# XXX: This shouldn't be a mixin. This should be contained by classes that
|
||||||
# want such behavior. But at this point, it wouldn't gain much for us
|
# want such behavior. But at this point, it wouldn't gain much for us
|
||||||
|
Loading…
Reference in New Issue
Block a user