diff options
Diffstat (limited to 'alot')
-rw-r--r-- | alot/account.py | 20 | ||||
-rwxr-xr-x | alot/init.py | 6 |
2 files changed, 15 insertions, 11 deletions
diff --git a/alot/account.py b/alot/account.py index 8d76a60b..74decc86 100644 --- a/alot/account.py +++ b/alot/account.py @@ -39,10 +39,10 @@ class Account(object): abook = None """addressbook (:class:`AddressBook`) managing this accounts contacts""" - def __init__(self, address=None, aliases=None, realname=None, gpg_key=None, - signature=None, signature_filename=None, sent_box=None, - draft_box=None, abook=None): - + def __init__(self, dbman, address=None, aliases=None, realname=None, + gpg_key=None, signature=None, signature_filename=None, + sent_box=None, draft_box=None, abook=None): + self.dbman = dbman self.address = address self.abook = abook self.aliases = [] @@ -130,12 +130,14 @@ class Account(object): class SendmailAccount(Account): """:class:`Account` that pipes a message to a `sendmail` shell command for sending""" - def __init__(self, cmd, **kwargs): + def __init__(self, dbman, cmd, **kwargs): """ + :param dbman: the database manager instance + :type dbman: :class:`~alot.db.DBManager` :param cmd: sendmail command to use for this account :type cmd: str """ - Account.__init__(self, **kwargs) + super(SendmailAccount, self).__init__(dbman, **kwargs) self.cmd = cmd def send_mail(self, mail): @@ -170,8 +172,10 @@ class AccountManager(object): accounts = [] ordered_addresses = [] - def __init__(self, config): + def __init__(self, dbman, config): """ + :param dbman: the database manager instance + :type dbman: :class:`~alot.db.DBManager` :param config: the config object to read account information from :type config: :class:`~alot.settings.AlotConfigParser`. """ @@ -201,7 +205,7 @@ class AccountManager(object): sender_type = args.pop('type', 'sendmail') if sender_type == 'sendmail': cmd = args.pop('sendmail_command', 'sendmail') - newacc = (SendmailAccount(cmd, **args)) + newacc = (SendmailAccount(dbman, cmd, **args)) self.accountmap[newacc.address] = newacc self.accounts.append(newacc) for alias in newacc.aliases: diff --git a/alot/init.py b/alot/init.py index 064eaf2e..8f5665e3 100755 --- a/alot/init.py +++ b/alot/init.py @@ -128,12 +128,12 @@ def main(): logger = logging.getLogger() #logger.debug(commands.COMMANDS) - #accountman - aman = AccountManager(settings.config) - # get ourselves a database manager dbman = DBManager(path=args['mailindex-path'], ro=args['read-only']) + #accountman + aman = AccountManager(dbman, settings.config) + # get initial searchstring try: if args.subCommand == 'search': |