示例#1
0
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    initialize_sql(engine)
    session_factory = session_factory_from_settings(settings)
    config = Configurator(settings=settings,
                          session_factory=session_factory)

    config.include('pyramid_mailer')
    config.add_translation_dirs(
        'colander:locale/',
        'deform:locale/',
        'c3sintent:locale/')
    config.add_static_view('static',
                           'c3sintent:static', cache_max_age=3600)

    config.add_subscriber('c3sintent.subscribers.add_base_template',
                          'pyramid.events.BeforeRender')
    config.add_subscriber('c3sintent.subscribers.add_locale_to_cookie',
                          'pyramid.events.NewRequest')
    # home /
    # membership application form
    config.add_route('intent', '/')

    config.scan()
    return config.make_wsgi_app()
示例#2
0
文件: __init__.py 项目: C3S/C3SIntent
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    initialize_sql(engine)
    session_factory = session_factory_from_settings(settings)
    config = Configurator(settings=settings, session_factory=session_factory)

    config.include('pyramid_mailer')
    config.add_translation_dirs('colander:locale/', 'deform:locale/',
                                'c3sintent:locale/')
    config.add_static_view('static', 'c3sintent:static', cache_max_age=3600)

    config.add_subscriber('c3sintent.subscribers.add_base_template',
                          'pyramid.events.BeforeRender')
    config.add_subscriber('c3sintent.subscribers.add_locale_to_cookie',
                          'pyramid.events.NewRequest')
    # home /
    # intent form
    config.add_route('intent', '/')
    config.add_route('disclaimer', '/disclaimer')
    config.add_route('faq', '/faq')
    config.add_route('success', '/success')
    config.add_route('success_check_email', '/check_email')
    config.add_route('success_verify_email', '/verify/{email}/{code}')
    config.add_route('success_pdf', '/C3S_DeclarationOfIntent_{namepart}.pdf')

    config.scan()
    return config.make_wsgi_app()
示例#3
0
文件: __init__.py 项目: C3S/C3SIntent
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    initialize_sql(engine)
    session_factory = session_factory_from_settings(settings)
    config = Configurator(settings=settings,
                          session_factory=session_factory)

    config.include('pyramid_mailer')
    config.add_translation_dirs(
        'colander:locale/',
        'deform:locale/',
        'c3sintent:locale/')
    config.add_static_view('static',
                           'c3sintent:static', cache_max_age=3600)

    config.add_subscriber('c3sintent.subscribers.add_base_template',
                          'pyramid.events.BeforeRender')
    config.add_subscriber('c3sintent.subscribers.add_locale_to_cookie',
                          'pyramid.events.NewRequest')
    # home /
    # intent form
    config.add_route('intent', '/')
    config.add_route('disclaimer', '/disclaimer')
    config.add_route('faq', '/faq')
    config.add_route('success', '/success')
    config.add_route('success_check_email', '/check_email')
    config.add_route('success_verify_email', '/verify/{email}/{code}')
    config.add_route('success_pdf', '/C3S_DeclarationOfIntent_{namepart}.pdf')

    config.scan()
    return config.make_wsgi_app()
示例#4
0
def _initTestingDB():
    """
    set up a database to run tests against
    """
    from sqlalchemy import create_engine
    from c3sintent.models import initialize_sql
    session = initialize_sql(create_engine('sqlite://'))
    return session
示例#5
0
def _initTestingDB():
    """
    set up a database to run tests against
    """
    from sqlalchemy import create_engine
    from c3sintent.models import initialize_sql
    try:
        session = initialize_sql(create_engine('sqlite:///:memory:'))
    except:
        session = DBSession
    return session
示例#6
0
def _initTestingDB():
    from sqlalchemy import create_engine
    from c3sintent.models import initialize_sql
    session = initialize_sql(create_engine('sqlite://'))
    return session
示例#7
0
def _initTestingDB():
    from sqlalchemy import create_engine
    from c3sintent.models import initialize_sql
    session = initialize_sql(create_engine('sqlite://'))
    return session