diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2011-09-22 14:00:27 +0200 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2011-09-22 14:00:27 +0200 |
commit | f857a31527556a92d0453434c922e4801f417c1e (patch) | |
tree | 1699f77bc442b9bdf2ae93c6e927f252d4964fa6 /alot | |
parent | 5add434c57d8e41582eb8f9804c3716ef5ba41e8 (diff) |
Fix the config file parsing wrt to quoted values and : as key
Diffstat (limited to 'alot')
-rw-r--r-- | alot/defaults/alot.rc | 12 | ||||
-rw-r--r-- | alot/settings.py | 19 |
2 files changed, 25 insertions, 6 deletions
diff --git a/alot/defaults/alot.rc b/alot/defaults/alot.rc index fbe2b318..773a5bef 100644 --- a/alot/defaults/alot.rc +++ b/alot/defaults/alot.rc @@ -44,14 +44,14 @@ terminal_cmd = x-terminal-emulator -e timestamp_format = '' # how to print messages: -# this specifies a shellcommand used pro printing. +# this specifies a shellcommand used pro printing. # threads/messages are piped to this as plaintext. # muttprint/a2ps works nicely print_cmd = #initial searchstring when none is given as argument: initial_searchstring = tag:inbox AND NOT tag:killed - + # in case more than one account has an addressbook: # Set this to True to make tabcompletion for recipients during compose only # look in the abook of the account matching the sender address @@ -71,7 +71,7 @@ m = compose o = 'prompt search ' q = exit ';' = bufferlist -':' = prompt +colon = prompt [bufferlist-maps] x = closefocussed @@ -256,10 +256,10 @@ message_header_bg = dark gray [1c-theme] message_body = default message_header = default -prompt = +prompt = message_attachment = default notify_normal = default -messagesummary_odd = +messagesummary_odd = threadline_content = default threadline_subject_focus = standout bufferlist_results_odd = default @@ -279,7 +279,7 @@ bufferlist_results_even = default threadline_authors_focus = standout footer = standout notify_error = standout -messagesummary_even = +messagesummary_even = threadline_tags_focus = standout threadline = default threadline_date = default diff --git a/alot/settings.py b/alot/settings.py index 39783ba2..d7a682c6 100644 --- a/alot/settings.py +++ b/alot/settings.py @@ -18,6 +18,7 @@ Copyright (C) 2011 Patrick Totzke <patricktotzke@gmail.com> """ import imp import os +import ast import mailcap import codecs @@ -56,6 +57,24 @@ class AlotConfigParser(FallbackConfigParser): except: pass + # fix quoted keys / values + for section in self.sections(): + for key, value in self.items(section): + if value and value[0] in "\"'": + value = ast.literal_eval(value) + + transformed_key = False + if key[0] in "\"'": + transformed_key = ast.literal_eval(key) + elif key == 'colon': + transformed_key = ':' + + if transformed_key: + self.remove_option(section, key) + self.set(section, transformed_key, value) + else: + self.set(section, key, value) + def get_palette(self): mode = self.getint('general', 'colourmode') ms = "%dc-theme" % mode |