Advertisement
Guest User

Untitled

a guest
Aug 8th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. class Config:
  2. def __init__(self,system):
  3. self.config = configparser.ConfigParser()
  4. self.config.read("config.ini")
  5. self.connection_source=self.config.get(system,'Source')
  6. self.system=system
  7.  
  8. def getsystemSources(self):
  9. return self.connection_source
  10.  
  11. def getConnection(self,source):
  12. self.source=source
  13. self.connection_string=self.config.get('CONNECTION',self.system+'_'+source+'_'+'connectstring') ## Connection
  14. self.connection_user=self.config.get('CONNECTION',self.system+'_'+source+'_'+'user') ## Connection user
  15. self.connection_password=self.config.get('CONNECTION',self.system+'_'+source+'_'+'password') ## Connection pass
  16.  
  17. class Connection(IngesConfig):
  18. def __init__ (self):
  19. self.connection_string=Config.connection_string
  20. self.connection_user=Config.connection_user
  21. self.connection_password=Config.connection_user
  22. self.connection_source=Config.connection_source
  23. def conn_function(self):
  24. print (self.connection_string)
  25. print (self.connection_user)
  26. print (self.connection_password)
  27.  
  28. emp1 = Config('Windows')
  29. value=emp1.getsystemSources()
  30. print (value)
  31. emp2 = Connection() -> how to run it ?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement