From f2ec29b1bc9db0a67d6178f06b68fb1df890a7ca Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Fri, 6 Jul 2018 17:39:06 +0200 Subject: [PATCH] Allow an empty config value e.g. this enables to configure gitlab.default_priority = --- bugwarrior/services/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bugwarrior/services/__init__.py b/bugwarrior/services/__init__.py index 0149fe2cb..581113254 100644 --- a/bugwarrior/services/__init__.py +++ b/bugwarrior/services/__init__.py @@ -2,6 +2,7 @@ from builtins import str from builtins import object +import ast import copy import multiprocessing import time @@ -73,11 +74,14 @@ def __init__(self, main_config, main_section, target): log.info("Working on [%s]", self.target) - def _get_config_or_default(self, key, default, as_type=lambda x: x): + def _get_config_or_default(self, key, default, as_type=None): """Return a main config value, or default if it does not exist.""" if self.main_config.has_option(self.main_section, key): - return as_type(self.main_config.get(self.main_section, key)) + if as_type: + return as_type(self.main_config.get(self.main_section, key)) + else: + return ast.literal_eval(self.main_config.get(self.main_section, key)) return default