Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ConfigParser
- class Section(object):
- def __init__(self,conf,section_name):
- self.conf = conf
- self.section = section_name
- def __getattr__(self,attr):
- print "getting the %s of the %s" % (attr,self.section)
- return self.conf.get(self.section,attr)
- class Configuration(object):
- def __init__(self,config_file):
- self.config_file = config_file
- self.parser = ConfigParser.ConfigParser()
- self.parser.read(self.config_file)
- def __get__(self,attr):
- print "is this even called ?"
- if attr:
- return getattr(self,attr)
- print "getting the %s section" % (attr)
- return Section(self,attr)
- class App(object):
- def __init__(self):
- self.config = Configuration("/etc/infomaniak.conf")
- def start(self):
- bottle.run(host='',port=self.config.port)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement