From 11320f095eff59e5fd266c747d6d2d4a2cd96637 Mon Sep 17 00:00:00 2001 From: Patrick Totzke Date: Sun, 11 Dec 2011 15:38:05 +0000 Subject: move hook lookups to AlotConfigParser issue #146 --- alot/commands/__init__.py | 4 ++-- alot/commands/envelope.py | 4 ++-- alot/commands/thread.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'alot/commands') diff --git a/alot/commands/__init__.py b/alot/commands/__init__.py index 2fbb8552..76ba0e0c 100644 --- a/alot/commands/__init__.py +++ b/alot/commands/__init__.py @@ -191,8 +191,8 @@ def commandfactory(cmdline, mode='global'): parms.update(forcedparms) logging.debug('PARMS: %s' % parms) - parms['prehook'] = alot.settings.hooks.get('pre_' + cmdname) - parms['posthook'] = alot.settings.hooks.get('post_' + cmdname) + parms['prehook'] = alot.settings.config.get_hook('pre_' + cmdname) + parms['posthook'] = alot.settings.config.get_hook('post_' + cmdname) logging.debug('cmd parms %s' % parms) return cmdclass(**parms) diff --git a/alot/commands/envelope.py b/alot/commands/envelope.py index 94a2e58d..2597e9de 100644 --- a/alot/commands/envelope.py +++ b/alot/commands/envelope.py @@ -166,7 +166,7 @@ class EditCommand(Command): f.close() # call post-edit translate hook - translate = settings.hooks.get('post_edit_translate') + translate = settings.config.get_hook('post_edit_translate') if translate: template = translate(template, ui=ui, dbm=ui.dbman, aman=ui.accountman, log=ui.logger, @@ -187,7 +187,7 @@ class EditCommand(Command): bodytext = self.envelope.body # call pre-edit translate hook - translate = settings.hooks.get('pre_edit_translate') + translate = settings.config.get_hook('pre_edit_translate') if translate: bodytext = translate(bodytext, ui=ui, dbm=ui.dbman, aman=ui.accountman, log=ui.logger, diff --git a/alot/commands/thread.py b/alot/commands/thread.py index 60984f88..464fb91a 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -42,7 +42,7 @@ class ReplyCommand(Command): # set body text name, address = self.message.get_author() timestamp = self.message.get_date() - qf = settings.hooks.get('reply_prefix') + qf = settings.config.get_hook('reply_prefix') if qf: quotestring = qf(name, address, timestamp, ui=ui, dbm=ui.dbman, aman=ui.accountman, @@ -146,7 +146,7 @@ class ForwardCommand(Command): # set body text name, address = self.message.get_author() timestamp = self.message.get_date() - qf = settings.hooks.get('forward_prefix') + qf = settings.config.get_hook('forward_prefix') if qf: quote = qf(name, address, timestamp, ui=ui, dbm=ui.dbman, aman=ui.accountman, -- cgit v1.2.3