Fix0red the implementation of makeChannelFilename.

This commit is contained in:
Jeremy Fincher 2004-12-10 23:40:46 +00:00
parent 2d4f625b83
commit 0ed2832b30

View File

@ -158,18 +158,15 @@ class DBHandler(object):
def makeChannelFilename(filename, channel=None, dirname=None): def makeChannelFilename(filename, channel=None, dirname=None):
# ??? This may not be right. # ??? This may not be right.
filename = os.path.basename(filename) filename = os.path.basename(filename)
if channel is not None and \ if channel is None or \
conf.get(conf.supybot.databases.plugins.channelSpecific, channel): not conf.get(conf.supybot.databases.plugins.channelSpecific, channel):
channel = conf.supybot.databases.plugins.channelSpecific.channel()
channel = ircutils.toLower(channel) channel = ircutils.toLower(channel)
if dirname is None: if dirname is None:
dir = conf.supybot.directories.data.dirize(channel) dirname = conf.supybot.directories.data.dirize(channel)
else: if not os.path.exists(dirname):
dir = os.path.join(dirname, channel) os.makedirs(dirname)
if not os.path.exists(dir): return os.path.join(dirname, filename)
os.makedirs(dir)
return os.path.join(dir, filename)
else:
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