示例#1
0
文件: main.py 项目: Governa/Camelot
 def setup_model():
     from sqlalchemy.orm import configure_mappers
     from camelot.core.sql import metadata
     metadata.bind = settings.ENGINE()
     import camelot.model.party
     import camelot.model.authentication
     import camelot.model.i18n
     import camelot.model.fixture
     import camelot.model.memento
     import camelot_example.model
     #
     # setup_all is only needed for those models that rely on elixir
     #
     from elixir import setup_all
     setup_all()
     #
     # create the tables for all models, configure mappers first, to make
     # sure all deferred properties have been handled, as those could
     # create tables or columns
     #
     configure_mappers()
     metadata.create_all()
     from camelot.model.authentication import update_last_login
     update_last_login()
     # 
     # Load sample data with the fixure mechanism
     #
     from camelot_example.fixtures import load_movie_fixtures
     load_movie_fixtures()
     #
     # setup the views
     #
     from camelot_example.view import setup_views
     setup_views()
示例#2
0
 def setup_model():
     from sqlalchemy.orm import configure_mappers
     from camelot.core.sql import metadata
     metadata.bind = settings.ENGINE()
     import camelot.model.party
     import camelot.model.authentication
     import camelot.model.i18n
     import camelot.model.fixture
     import camelot.model.memento
     import camelot.model.batch_job
     import camelot_example.model
     #
     # create the tables for all models, configure mappers first, to make
     # sure all deferred properties have been handled, as those could
     # create tables or columns
     #
     configure_mappers()
     metadata.create_all()
     from camelot.model.authentication import update_last_login
     #update_last_login()
     # 
     # Load sample data with the fixure mechanism
     #
     from camelot_example.fixtures import load_movie_fixtures
     load_movie_fixtures()
     #
     # setup the views
     #
     from camelot_example.view import setup_views
     setup_views()
示例#3
0
 def setup_model():
     from sqlalchemy.orm import configure_mappers
     from camelot.core.sql import metadata
     metadata.bind = settings.ENGINE()
     #
     # import all the needed model files to make sure the mappers and tables
     # are defined before creating them in the database
     #
     from camelot.model import (party, authentication, i18n, fixture,
                                memento, batch_job)
     from . import model
     logger.debug('loaded datamodel for %s'%party.__name__)
     logger.debug('loaded datamodel for %s'%authentication.__name__)
     logger.debug('loaded datamodel for %s'%i18n.__name__)
     logger.debug('loaded datamodel for %s'%fixture.__name__)
     logger.debug('loaded datamodel for %s'%memento.__name__)
     logger.debug('loaded datamodel for %s'%batch_job.__name__)
     logger.debug('loaded datamodel for %s'%model.__name__)
     #
     # create the tables for all models, configure mappers first, to make
     # sure all deferred properties have been handled, as those could
     # create tables or columns
     #
     configure_mappers()
     metadata.create_all()
     # 
     # Load sample data with the fixure mechanism
     #
     from camelot_example.fixtures import load_movie_fixtures
     load_movie_fixtures()
     #
     # setup the views
     #
     from camelot_example.view import setup_views
     setup_views()
 def setup_model( self ):
     """This function will be called at application startup, it is used to 
     setup the model"""
     from camelot.core.sql import metadata
     from sqlalchemy.orm import configure_mappers
     metadata.bind = self.ENGINE()
     import camelot.model.i18n
     import subs.model
     configure_mappers()
     metadata.create_all()
示例#5
0
 def setup_model(self):
     """This function will be called at application startup, it is used to setup the model"""
     from camelot.core.sql import metadata
     from sqlalchemy.orm import configure_mappers
     metadata.bind = self.ENGINE()
     import camelot.model.authentication
     import camelot.model.i18n
     import camelot.model.memento
     import agenda.model
     configure_mappers()
     metadata.create_all()
示例#6
0
文件: main.py 项目: inducer/gradebook
    def setup_model(self):
        from camelot.core.sql import metadata
        from sqlalchemy.orm import configure_mappers
        import camelot.model.authentication
        import camelot.model.i18n
        import camelot.model.memento  # noqa
        import gradebook.model  # noqa

        metadata.bind = self.ENGINE()
        configure_mappers()
        metadata.create_all()
示例#7
0
 def setup_model( self ):
     """This function will be called at application startup, it is used to 
     setup the model"""
     from camelot.core.sql import metadata
     from camelot.core.orm import setup_all
     metadata.bind = self.ENGINE()
     import camelot.model.authentication
     import camelot.model.i18n
     import camelot.model.memento
     import cobranza.model
     setup_all()
     metadata.create_all()
示例#8
0
 def setUp( self ):
     metadata.bind = settings.ENGINE()
     metadata.create_all()
     self.session = Session()
     #
     # insert the value of i in each column of T, that can be searched for
     #
     for (i,name), definition in types_to_test.items():
         value = self.value_for_type( definition, i )
         t = T()
         setattr( t, name, value )
     self.session.flush()
     self.admin = TAdmin()
示例#9
0
def setup_all(create_tables=False, *args, **kwargs):
    """Create all tables that are registered in the metadata
    """
    process_deferred_properties()
    if create_tables:
        metadata.create_all(*args, **kwargs)
示例#10
0
def setup_all( create_tables=False, *args, **kwargs ):
    """Create all tables that are registered in the metadata
    """
    if create_tables:
        metadata.create_all( *args, **kwargs )
示例#11
0
 def setUp(self):
     super(ExampleModelCase, self).setUp()
     from camelot.model import (authentication, batch_job, fixture, party,
                                i18n, memento)
     metadata.bind = settings.ENGINE()
     metadata.create_all()
示例#12
0
def setup_all( create_tables=False, *args, **kwargs ):
    """Create all tables that are registered in the metadata
    """
    process_deferred_properties()
    if create_tables:
        metadata.create_all( *args, **kwargs )
示例#13
0
 def setUp( self ):
     super( ExampleModelCase, self ).setUp()
     from camelot.model import ( authentication, batch_job, fixture,
                                 party, i18n, memento )
     metadata.bind = settings.ENGINE()
     metadata.create_all()