1
0
mirror of https://github.com/gryf/slack-backup.git synced 2025-12-17 19:40:21 +01:00

2 Commits
v0.4 ... v0.4.2

Author SHA1 Message Date
3f95986981 Fix the tests.
For some reason, database key was treated differently in configparser object
in python 3.4.2. In Python 3.4.5 everything is fine. Fixed the defaults to
make sure all string options are treated equally.
2016-11-28 18:14:47 +01:00
6d5f3746a2 Superfast fix for non-existed config parameter in cmdline options 2016-11-28 17:20:14 +01:00
3 changed files with 18 additions and 15 deletions

View File

@@ -10,7 +10,7 @@ except ImportError:
setup(name="slack-backup",
packages=["slack_backup"],
version="0.4",
version="0.4.2",
description="Make copy of slack converstaions",
author="Roman Dobosz",
author_email="gryf73@gmail.com",

View File

@@ -53,7 +53,11 @@ class Config(object):
def load_config(self, args):
locations = [args.config,
path = ''
if hasattr(args, 'config') and args.config:
path = args.config
locations = [path,
'./slack-backup.conf',
os.path.expandvars('$XDG_CONFIG_HOME/slack-backup.ini'),
os.path.expandvars('$HOME/.config/slack-backup.ini')]
@@ -79,19 +83,25 @@ class Config(object):
val = self.cp.get(section, option, fallback='[]')
val = json.loads(val)
else:
val = self.cp.get(section, option, fallback='')
val = self.cp.get(section, option, fallback=None)
self._options[option] = val
def update_args(self, args):
if 'parser' not in args:
# it doesn't make sense to update args, since no action was
# choosen
return
# special case, re-set information for verbose/quiet options
if args.verbose is not None and self._options['quiet'] is not None:
self._options['quiet'] = 0
if 'verbose' in args and args.verbose is not None:
self._options['verbose'] = args.verbose
if args.quiet is not None and self._options['verbose'] is not None:
self._options['verbose'] = 0
if self._options['quiet'] is not None:
self._options['quiet'] = 0
if 'quiet' in args and args.quiet is not None:
self._options['quiet'] = args.quiet
if self._options['verbose'] is not None:
self._options['verbose'] = 0
for sec_id in (args.parser, 'common'):
for option in self.sections[sec_id]:

View File

@@ -51,13 +51,6 @@ class TestConfig(unittest.TestCase):
args.config = None
args.parser = 'fetch'
args.verbose = 2
args.quiet = None
args.channels = None
args.database = None
args.user = None
args.password = None
args.team = None
args.token = None
conf = config.Config()
conf.update(args)
@@ -66,7 +59,7 @@ class TestConfig(unittest.TestCase):
'verbose': 2,
'quiet': 0,
'channels': [],
'database': '',
'database': None,
'user': None,
'password': None,
'team': None,