aboutsummaryrefslogtreecommitdiffstats
path: root/lib/python2.7/site-packages/sqlalchemy_migrate-0.7.2-py2.7.egg/migrate/versioning/cfgparse.py
blob: ff27d672645c7b500bdb9ca94f911fd21321baa8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""
   Configuration parser module.
"""

from ConfigParser import ConfigParser

from migrate.versioning.config import *
from migrate.versioning import pathed


class Parser(ConfigParser):
    """A project configuration file."""

    def to_dict(self, sections=None):
        """It's easier to access config values like dictionaries"""
        return self._sections


class Config(pathed.Pathed, Parser):
    """Configuration class."""

    def __init__(self, path, *p, **k):
        """Confirm the config file exists; read it."""
        self.require_found(path)
        pathed.Pathed.__init__(self, path)
        Parser.__init__(self, *p, **k)
        self.read(path)