diff options
author | Patrick Totzke <patricktotzke@gmail.com> | 2012-03-16 10:29:25 +0000 |
---|---|---|
committer | Patrick Totzke <patricktotzke@gmail.com> | 2012-03-17 16:14:23 +0000 |
commit | 45dddcfbafd839061efa829925040d2489abe552 (patch) | |
tree | 8c1ef958408501031d57c76b961502bf42536373 | |
parent | 0a3f35d2da7026699659bb50181829e3d7184633 (diff) |
get_mime_handler -> mailcap_find_match
this introduces mailcap_find_match, wich essentially
just calls mailcap.find_match but curries the first argument
-rw-r--r-- | alot/settings/__init__.py | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/alot/settings/__init__.py b/alot/settings/__init__.py index 210fb5f4..9083a13d 100644 --- a/alot/settings/__init__.py +++ b/alot/settings/__init__.py @@ -322,32 +322,12 @@ class SettingsManager(object): abooks.append(a.abook) return abooks - def get_mime_handler(self, mime_type, key='view', interactive=True): + def mailcap_find_match(self, *args, **kwargs): """ - get shellcomand defined in the users `mailcap` as handler for files of - given `mime_type`. - - :param mime_type: file type - :type mime_type: str - :param key: identifies one of possibly many commands for this type by - naming the intended usage, e.g. 'edit' or 'view'. Defaults - to 'view'. - :type key: str - :param interactive: choose the "interactive session" handler rather - than the "print to stdout and immediately return" - handler - :type interactive: bool + Propagates :func:`mailcap.find_match` but caches the mailcap (first + argument) """ - if interactive: - mc_tuple = mailcap.findmatch(self._mailcaps, mime_type, key=key) - else: - mc_tuple = mailcap.findmatch(self._mailcaps, mime_type, - key='copiousoutput') - if mc_tuple: - if mc_tuple[1]: - return mc_tuple[1][key] - else: - return None + return mailcap.findmatch(self._mailcaps, *args, **kwargs) settings = SettingsManager() |