X-Git-Url: https://vcs.fsf.org/?p=rainbowstream.git;a=blobdiff_plain;f=rainbowstream%2Fconfig.py;h=5f5b81bd18fe67f23339fe631e6e7b9b3e6b25ea;hp=c2f2d5cd9ddba696a49e2f6bfe25c1155dbbd85a;hb=6bb36e28788f8763ccad6ef4f1afa2122e526569;hpb=9c37209ba97ff291a21cd7d936988c8d5b5fc1d2 diff --git a/rainbowstream/config.py b/rainbowstream/config.py index c2f2d5c..5f5b81b 100644 --- a/rainbowstream/config.py +++ b/rainbowstream/config.py @@ -6,7 +6,7 @@ from collections import OrderedDict # Regular expression for comments in config file comment_re = re.compile( - '(^)?[^\S\n]*/(?:\*(.*?)\*/[^\S\n]*|/[^\n]*)($)?', + '(^)[^\S\n]*/(?:\*(.*?)\*/[^\S\n]*|/[^\n]*)($)?', re.DOTALL | re.MULTILINE ) @@ -49,6 +49,8 @@ def get_all_config(): data.pop('ONLY_LIST', None) data.pop('IGNORE_LIST', None) data.pop('FORMAT', None) + data.pop('QUOTE_FORMAT', None) + data.pop('NOTIFY_FORMAT', None) return data except: return [] @@ -109,7 +111,7 @@ def delete_config(key): Delete a config key """ path = os.path.expanduser("~") + os.sep + '.rainbow_config.json' - try: + try: data = load_config(path) except: raise Exception('Config file is messed up.') @@ -133,8 +135,9 @@ def reload_config(): """ Reload config """ - try: - rainbow_config = os.path.expanduser("~") + os.sep + '.rainbow_config.json' + try: + rainbow_config = os.path.expanduser("~") + \ + os.sep + '.rainbow_config.json' data = load_config(rainbow_config) for d in data: c[d] = data[d] @@ -161,7 +164,7 @@ def init_config(): data = load_config(rainbow_config) for d in data: c[d] = data[d] - except ValueError as e: + except (IOError, ValueError) as e: c['USER_JSON_ERROR'] = str(e) # Load default theme theme_file = os.path.dirname(__file__) + \