Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(1)  |  Call(1)  |  Derive(0)  |  Import(0)
Creates and returns a connection based on the information in the configuration object.

The configuration object should be an instance of the Core.Environment.Configuration class.
The underlying configuration file should contain a section 'DATABASE' with the value
host, user, password and database

        def ConnectionFromConfiguration(configuration):

	'''Creates and returns a connection based on the information in the configuration object.
	
	The configuration object should be an instance of the Core.Environment.Configuration class.
	The underlying configuration file should contain a section 'DATABASE' with the value
	host, user, password and database'''

	connection = MySQLdb.connect(host=configuration.get("DATABASE", "host"),
				 user=configuration.get("DATABASE","user"),
				 passwd=configuration.get("DATABASE", "password"), 
				 db=configuration.get("DATABASE", "database"))	
				 
	return connection			 
        


src/p/e/PEATDB-2.3/PEATDB/plugins/PEATSAplugin.py   PEATDB(Download)
    def connect(self, configuration):
        """Create connection"""
        self.connection = PEATSA.WebApp.UtilityFunctions.ConnectionFromConfiguration(configuration)
        self.jobManager = PEATSA.WebApp.Data.JobManager(self.connection)
        self.jobManager.setJobStateLogging('jobstates.log',interval=60)