示例#1
0
def setup_app(command, conf, vars):
    """Place any commands to setup sso here"""
#    load_environment(conf.global_conf, conf.local_conf)
    print "command", command
    print "conf", conf
    print "vars", vars
    # Create the tables if they don't already exist
#    meta.metadata.create_all(bind=meta.engine)

    engine = engine_from_config(conf, 'sqlalchemy.')
    initialize_sql(engine)
    
    init_data()
示例#2
0
def setup_app(command, conf, vars):
    """Place any commands to setup sso here"""
    #    load_environment(conf.global_conf, conf.local_conf)
    print "command", command
    print "conf", conf
    print "vars", vars
    # Create the tables if they don't already exist
    #    meta.metadata.create_all(bind=meta.engine)

    engine = engine_from_config(conf, 'sqlalchemy.')
    initialize_sql(engine)

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

    authn_policy = AuthTktAuthenticationPolicy('sosecret',
                                               callback=groupfinder)
    authz_policy = ACLAuthorizationPolicy()
    config = Configurator(settings=settings,
                          root_factory='motionman.models.RootFactory',
                          authentication_policy=authn_policy,
                          authorization_policy=authz_policy)

    #config = Configurator(settings=settings)
    config.add_static_view('static', 'motionman:static')
    config.add_route('home', '/')

    config.add_route('setting_edit', '/setting/edit')

    config.add_route('user_list', '/user/list')
    config.add_route('user_add', '/user/add')
    config.add_route('user_edit', '/user/edit/{id}')
    config.add_route('user_delete', '/user/delete/{id}')

    config.add_route('motion_list', '/motion/list')
    config.add_route('motion_add', '/motion/add')
    config.add_route('motion_vote', '/motion/vote/{id}/{chips}')
    config.add_route('motion_message', '/motion/message/{id}')

    config.add_route('login', '/login')
    config.add_route('logout', '/logout')

    config.add_view('motionman.views.login.login',
                    context='pyramid.httpexceptions.HTTPForbidden',
                    renderer='motionman:templates/login.pt')

    config.scan('motionman.views')

    return config.make_wsgi_app()
示例#4
0
def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    engine = engine_from_config(settings, 'sqlalchemy.')
    initialize_sql(engine)
    
    authn_policy = AuthTktAuthenticationPolicy(
        'sosecret', callback=groupfinder)
    authz_policy = ACLAuthorizationPolicy()
    config = Configurator(settings=settings,
                          root_factory='motionman.models.RootFactory',
                          authentication_policy=authn_policy,
                          authorization_policy=authz_policy)
    
    #config = Configurator(settings=settings)
    config.add_static_view('static', 'motionman:static')
    config.add_route('home', '/')

    config.add_route('setting_edit', '/setting/edit')

    config.add_route('user_list', '/user/list')
    config.add_route('user_add', '/user/add')
    config.add_route('user_edit', '/user/edit/{id}')
    config.add_route('user_delete', '/user/delete/{id}')
    
    config.add_route('motion_list', '/motion/list')
    config.add_route('motion_add', '/motion/add')
    config.add_route('motion_vote', '/motion/vote/{id}/{chips}')
    config.add_route('motion_message', '/motion/message/{id}')

    config.add_route('login', '/login')
    config.add_route('logout', '/logout')

    config.add_view('motionman.views.login.login',
                    context='pyramid.httpexceptions.HTTPForbidden',
                    renderer='motionman:templates/login.pt')
    
    config.scan('motionman.views')

    return config.make_wsgi_app()
示例#5
0
import logging
import unittest

from pyramid import testing
from pyramid.config import Configurator

log = logging.getLogger(__name__)

__all__ = ['session', 'TestBase']

from sqlalchemy import create_engine
from motionman.models import initialize_sql
initialize_sql(create_engine('sqlite://'))
from motionman.models.init_data import init_data
init_data()

class TestBase(unittest.TestCase):
            
    def setUp(self):
        self.config = testing.setUp()
        self.request = testing.DummyRequest()
        log.info(self._testMethodName + " start...")
        
    def tearDown(self):
        testing.tearDown()
        log.info(self._testMethodName + " end...")

示例#6
0
import logging
import unittest

from pyramid import testing
from pyramid.config import Configurator

log = logging.getLogger(__name__)

__all__ = ['session', 'TestBase']

from sqlalchemy import create_engine
from motionman.models import initialize_sql
initialize_sql(create_engine('sqlite://'))
from motionman.models.init_data import init_data
init_data()


class TestBase(unittest.TestCase):
    def setUp(self):
        self.config = testing.setUp()
        self.request = testing.DummyRequest()
        log.info(self._testMethodName + " start...")

    def tearDown(self):
        testing.tearDown()
        log.info(self._testMethodName + " end...")