accountsdb: always save files into the data directory

This commit is contained in:
James Lu 2018-12-30 14:22:38 -08:00
parent 3c23e0e319
commit c0d15face0
4 changed files with 9 additions and 11 deletions

View File

@ -1,11 +1,11 @@
# Autogenerated by update-modules.py on Sun Dec 30 13:09:36 2018 - DO NOT EDIT THIS COPY DIRECTLY!
# Autogenerated by update-modules.py on Sun Dec 30 14:20:44 2018 - DO NOT EDIT THIS COPY DIRECTLY!
"""
Shared code for database handling.
"""
import pickle
from supybot import ircdb, log
from supybot import ircdb, log, conf
class AccountsDB():
"""
@ -22,7 +22,7 @@ class AccountsDB():
"""
self.db = {}
self._plugin_name = plugin_name
self.filename = filename
self.filename = conf.supybot.directories.data.dirize(filename)
try:
with open(self.filename, 'rb') as f:
self.db = pickle.load(f)

View File

@ -51,7 +51,7 @@ class LastFM(callbacks.Plugin):
def __init__(self, irc):
self.__parent = super(LastFM, self)
self.__parent.__init__(irc)
self.db = accountsdb.AccountsDB("LastFM", filename)
self.db = accountsdb.AccountsDB("LastFM", "LastFM.db")
world.flushers.append(self.db.flush)
# 2.0 API (see http://www.lastfm.de/api/intro)
@ -212,8 +212,6 @@ class LastFM(callbacks.Plugin):
irc.reply("%(id)s (realname: %(realname)s) registered on %(registered)s; age: %(age)s; gender: %(gender)s; "
"Country: %(country)s; Tracks played: %(playcount)s" % profile)
filename = conf.supybot.directories.data.dirize("LastFM.db")
Class = LastFM

View File

@ -1,11 +1,11 @@
# Autogenerated by update-modules.py on Sun Dec 30 13:09:36 2018 - DO NOT EDIT THIS COPY DIRECTLY!
# Autogenerated by update-modules.py on Sun Dec 30 14:20:44 2018 - DO NOT EDIT THIS COPY DIRECTLY!
"""
Shared code for database handling.
"""
import pickle
from supybot import ircdb, log
from supybot import ircdb, log, conf
class AccountsDB():
"""
@ -22,7 +22,7 @@ class AccountsDB():
"""
self.db = {}
self._plugin_name = plugin_name
self.filename = filename
self.filename = conf.supybot.directories.data.dirize(filename)
try:
with open(self.filename, 'rb') as f:
self.db = pickle.load(f)

View File

@ -4,7 +4,7 @@ Shared code for database handling.
import pickle
from supybot import ircdb, log
from supybot import ircdb, log, conf
class AccountsDB():
"""
@ -21,7 +21,7 @@ class AccountsDB():
"""
self.db = {}
self._plugin_name = plugin_name
self.filename = filename
self.filename = conf.supybot.directories.data.dirize(filename)
try:
with open(self.filename, 'rb') as f:
self.db = pickle.load(f)