catch get exception in cfgfile, not in other places
This commit is contained in:
parent
a029c096c8
commit
24c51481dc
@ -11,7 +11,6 @@ import configparser
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
class Conf(object):
|
class Conf(object):
|
||||||
confobj = configparser.RawConfigParser()
|
confobj = configparser.RawConfigParser()
|
||||||
cfgfile = ''
|
cfgfile = ''
|
||||||
@ -57,7 +56,10 @@ class Conf(object):
|
|||||||
"""
|
"""
|
||||||
if not self.cfgfile:
|
if not self.cfgfile:
|
||||||
raise Exception('No config file set')
|
raise Exception('No config file set')
|
||||||
|
try:
|
||||||
return self.confobj.get(section, option)
|
return self.confobj.get(section, option)
|
||||||
|
except configparser.NoOptionError:
|
||||||
|
raise ValueError('Option does not exist')
|
||||||
|
|
||||||
def set(self, section, option, value):
|
def set(self, section, option, value):
|
||||||
"""docstring for update"""
|
"""docstring for update"""
|
||||||
|
@ -85,7 +85,7 @@ def workdir(directory):
|
|||||||
reverse_sort = False
|
reverse_sort = False
|
||||||
try:
|
try:
|
||||||
reverse_sort = (dir_config.get("Main", "reverse") == 'True')
|
reverse_sort = (dir_config.get("Main", "reverse") == 'True')
|
||||||
except NoOptionError:
|
except ValueError:
|
||||||
reverse_sort = False
|
reverse_sort = False
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user