Skip to content

Commit

Permalink
Merge pull request #54 from coddingtonbear/cautious_configuration_han…
Browse files Browse the repository at this point in the history
…dling

Raise an exception if we can't parse configuration; ignore simple config...
  • Loading branch information
coddingtonbear committed Apr 15, 2014
2 parents 3c8adfe + fc1beae commit e4b02c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
10 changes: 10 additions & 0 deletions taskw/taskrc.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ def _add_to_tree(self, config, key, value):
for part in key_parts[0:-1]:
if part not in cursor:
cursor[part] = {}
# Unfortunately, collapsing our configuration into a dict
# has some downsides -- we can't store both of the following
# simultaneously::
#
# color = on
# color.header = something
#
# So we err on the side of storing more.
if not isinstance(cursor[part], dict):
cursor[part] = {}
cursor = cursor[part]
cursor[key_parts[-1]] = value
return config
Expand Down
9 changes: 1 addition & 8 deletions taskw/warrior.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,14 +441,7 @@ def __init__(
super(TaskWarriorShellout, self).__init__(config_filename)
self.config_overrides = config_overrides if config_overrides else {}
self._marshal = marshal
try:
self.config = TaskRc(config_filename, overrides=config_overrides)
except:
logger.exception(
"Error encountered while loading configuration file "
"at '%s'",
config_filename,
)
self.config = TaskRc(config_filename, overrides=config_overrides)

def get_configuration_override_args(self):
config_overrides = self.DEFAULT_CONFIG_OVERRIDES.copy()
Expand Down

0 comments on commit e4b02c5

Please sign in to comment.