old_contents: #!/usr/bin/env python3.3
  # _*_ coding: utf-8 _*_
  #
  # Read configuration file or return default values
  #
  # Copyright (c) 2015	Pieter-Jan Moreels
  
  # Imports
  import os
  import sys
  runpath=os.path.dirname(os.path.realpath(__file__))
  
  import pymongo
  
  import configparser
  
  class Configuration():
    cp=configparser.ConfigParser()
    config=None
    if config:
      cp.read(config)
    else:
      cp.read(os.path.join(runpath, '../configuration.ini'))
    default={'mongoHost': 'localhost', 'mongoPort': 27017,
             'mongoDB': 'cvedb',
             'flaskPost': '127.0.0.1', 'flaskPort': 5050,
             'flaskDebug': True,
             'cve-searchPath': os.path.join(runpath, '../../../cve-search/') }
  
    @classmethod
    def read(cls, section, item, default):
      result=default
      try:
        if type(default) == bool:
          result=cls.cp.getboolean(section, item)
        elif type(default) == int:
          result=cls.cp.getint(section, item)
        else:
          result=cls.cp.get(section,item)
      except:
        pass
      return result
  
    # Mongo
    @classmethod
    def getMongoDB(cls):
      return cls.read('Mongo','DB',cls.default['mongoDB'])
    @classmethod
    def getMongoConnection(cls, host=None, port=None, db=None):
      h=host if host else cls.read('Mongo','Host',cls.default['mongoHost'])
      p=port if port else cls.read('Mongo','Port',cls.default['mongoPort'])
      d=db if db else cls.getMongoDB()
      c=pymongo.MongoClient(h,p)
      return c[d]
  
    # Flask
    @classmethod
    def getFlaskHost(cls):
      return cls.read('Webserver','Host',cls.default['flaskHost'])
    @classmethod
    def getFlaskPort(cls):
      return cls.read('Webserver','Port',cls.default['flaskPort'])
    @classmethod
    def getFlaskDebug(cls):
      return cls.read('Webserver','Debug',cls.default['flaskDebug'])
  
    # CVE-Search
    @classmethod
    def getCVESearchPath(cls):
      p=cls.read('CVE-Search', 'CVE-SearchPath', cls.default['cve-searchPath'])
      if p.startswith('.'):
        # relative path
        p=os.path.join(runpath, '../', p)
      return p
  
new_contents: #!/usr/bin/env python3.3
  # _*_ coding: utf-8 _*_
  #
  # Read configuration file or return default values
  #
  # Copyright (c) 2015	Pieter-Jan Moreels
  
  # Imports
  import os
  import sys
  runpath=os.path.dirname(os.path.realpath(__file__))
  
  import pymongo
  
  import configparser
  
  class Configuration():
    cp=configparser.ConfigParser()
    config=None
    if config:
      cp.read(config)
    else:
      cp.read(os.path.join(runpath, '../configuration.ini'))
    default={'mongoHost': 'localhost', 'mongoPort': 27017,
             'mongoDB': 'cvedb',
             'flaskHost': '127.0.0.1', 'flaskPort': 5050,
             'flaskDebug': True,
             'cve-searchPath': os.path.join(runpath, '../../../cve-search/') }
  
    @classmethod
    def read(cls, section, item, default):
      result=default
      try:
        if type(default) == bool:
          result=cls.cp.getboolean(section, item)
        elif type(default) == int:
          result=cls.cp.getint(section, item)
        else:
          result=cls.cp.get(section,item)
      except:
        pass
      return result
  
    # Mongo
    @classmethod
    def getMongoDB(cls):
      return cls.read('Mongo','DB',cls.default['mongoDB'])
    @classmethod
    def getMongoConnection(cls, host=None, port=None, db=None):
      h=host if host else cls.read('Mongo','Host',cls.default['mongoHost'])
      p=port if port else cls.read('Mongo','Port',cls.default['mongoPort'])
      d=db if db else cls.getMongoDB()
      c=pymongo.MongoClient(h,p)
      return c[d]
  
    # Flask
    @classmethod
    def getFlaskHost(cls):
      return cls.read('Webserver','Host',cls.default['flaskHost'])
    @classmethod
    def getFlaskPort(cls):
      return cls.read('Webserver','Port',cls.default['flaskPort'])
    @classmethod
    def getFlaskDebug(cls):
      return cls.read('Webserver','Debug',cls.default['flaskDebug'])
  
    # CVE-Search
    @classmethod
    def getCVESearchPath(cls):
      p=cls.read('CVE-Search', 'CVE-SearchPath', cls.default['cve-searchPath'])
      if p.startswith('.'):
        # relative path
        p=os.path.join(runpath, '../', p)
      return p
  
subject: correct typo