[2] | 1 | import sys, config |
---|
| 2 | import galaxy.model |
---|
| 3 | from galaxy.web import security |
---|
| 4 | |
---|
| 5 | class UniverseApplication( object ): |
---|
| 6 | """Encapsulates the state of a Universe application""" |
---|
| 7 | def __init__( self, **kwargs ): |
---|
| 8 | print >> sys.stderr, "python path is: " + ", ".join( sys.path ) |
---|
| 9 | # Read config file and check for errors |
---|
| 10 | self.config = config.Configuration( **kwargs ) |
---|
| 11 | self.config.check() |
---|
| 12 | config.configure_logging( self.config ) |
---|
| 13 | # Determine the database url |
---|
| 14 | if self.config.database_connection: |
---|
| 15 | db_url = self.config.database_connection |
---|
| 16 | else: |
---|
| 17 | db_url = "sqlite://%s?isolation_level=IMMEDIATE" % self.config.database |
---|
| 18 | # Setup the database engine and ORM |
---|
| 19 | self.model = galaxy.model.mapping.init( self.config.file_path, |
---|
| 20 | db_url, |
---|
| 21 | self.config.database_engine_options, |
---|
| 22 | create_tables = True ) |
---|
| 23 | # Security helper |
---|
| 24 | self.security = security.SecurityHelper( id_secret=self.config.id_secret ) |
---|
| 25 | def shutdown( self ): |
---|
| 26 | pass |
---|