File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed
Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 11#!/usr/bin/env python
22
3- from __future__ import print_function
4-
53import os
64
75import click
Original file line number Diff line number Diff line change @@ -46,22 +46,26 @@ class StackdioConfig(object):
4646 str (False ): False ,
4747 }
4848
49- def __init__ (self , config_file = CFG_FILE , section = 'main ' ):
49+ def __init__ (self , config_file = CFG_FILE , section = 'stackdio ' ):
5050 super (StackdioConfig , self ).__init__ ()
5151
5252 self .section = section
5353
5454 self ._cfg_file = config_file
5555
56- self .usable_config = os .path .isfile (config_file )
57-
5856 self ._config = ConfigParser ()
5957
60- if not self .usable_config :
61- self . _config . add_section ( section )
62- else :
58+ self . usable_file = os . path . isfile ( self ._cfg_file )
59+
60+ if self . usable_file :
6361 self ._config .read (config_file )
6462
63+ self .usable_section = self ._config .has_section (self .section )
64+ self .usable_config = self .usable_file and self .usable_section
65+
66+ if not self .usable_section :
67+ self ._config .add_section (section )
68+
6569 def save (self ):
6670 with open (self ._cfg_file , 'w' ) as f :
6771 self ._config .write (f )
You can’t perform that action at this time.
0 commit comments