~fox1991/wicd/fox

« back to all changes in this revision

Viewing changes to wicd/configmanager.py

  • Committer: Adam Blackburn
  • Date: 2010-10-29 15:32:33 UTC
  • Revision ID: abkbrn@gmail.com-20101029153233-l20v67r3qyds2zx8
work with Python < 2.7 again

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
25
25
#
26
26
 
27
 
import os, copy
 
27
import sys, os, copy
28
28
 
29
29
from ConfigParser import RawConfigParser, ParsingError
30
30
 
35
35
class ConfigManager(RawConfigParser):
36
36
    """ A class that can be used to manage a given configuration file. """
37
37
    def __init__(self, path, debug=False, mark_whitespace="`'`"):
38
 
        RawConfigParser.__init__(self, allow_no_value=True)
 
38
        if sys.version_info >= (2, 7, 0):
 
39
            RawConfigParser.__init__(self, allow_no_value=True)
 
40
        else:
 
41
            RawConfigParser.__init__(self)
39
42
        self.config_file = path
40
43
        self.debug = debug
41
44
        self.mrk_ws = mark_whitespace
46
49
            try:
47
50
                self.read(path)
48
51
            except ParsingError, p:
49
 
                import sys
50
52
                print "Could not start wicd: %s" % p.message
51
53
                sys.exit(1)
52
54