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 = ircutils.toLower(channel) channel = conf.supybot.databases.plugins.channelSpecific.channel()
if dirname is None: channel = ircutils.toLower(channel)
dir = conf.supybot.directories.data.dirize(channel) if dirname is None:
else: dirname = conf.supybot.directories.data.dirize(channel)
dir = os.path.join(dirname, channel) if not os.path.exists(dirname):
if not os.path.exists(dir): os.makedirs(dirname)
os.makedirs(dir) return os.path.join(dirname, filename)
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