def main(global_config, **settings): """ This function returns a Pyramid WSGI application. """ engine = engine_from_config(settings, 'sqlalchemy.') initialize_sql(engine) config = Configurator(settings=settings) config.add_static_view('static', 'pyramidapp:static') config.add_route('home', '/') config.add_view('pyramidapp.views.my_view', route_name='home', renderer='templates/mytemplate.pt') # pyramid_formalchemy's configuration config.include('pyramid_fanstatic') config.include('pyramid_formalchemy') config.include('fa.jquery') # register an admin UI config.formalchemy_admin('/admin', package='pyramidapp', view='fa.jquery.pyramid.ModelView') # register an admin UI for a single model config.formalchemy_model('/foo', package='pyramidapp', view='fa.jquery.pyramid.ModelView', model='pyramidapp.models.Foo') return config.make_wsgi_app()
def main(global_config, **settings): """ This function returns a Pyramid WSGI application. """ engine = engine_from_config(settings, 'sqlalchemy.') initialize_sql(engine) config = Configurator(settings=settings) config.add_static_view('static', 'pyramidapp:static') config.add_route('home', '/') config.add_view('pyramidapp.views.my_view', route_name='home', renderer='templates/mytemplate.pt') # pyramid_formalchemy's configuration config.include('pyramid_formalchemy') config.include('fa.jquery') # register an admin UI config.formalchemy_admin('/admin', package='pyramidapp', view='fa.jquery.pyramid.ModelView') # register an admin UI for a single model config.formalchemy_model('/foo', package='pyramidapp', view='fa.jquery.pyramid.ModelView', model='pyramidapp.models.Foo') return config.make_wsgi_app()
def main(global_config, **settings): """ This function returns a Pyramid WSGI application. """ engine = engine_from_config(settings, 'sqlalchemy.') initialize_sql(engine) # configure the security stuff config = Configurator( settings=settings, authentication_policy=RemoteUserAuthenticationPolicy(), authorization_policy=ACLAuthorizationPolicy()) config.add_static_view('static', 'pyramidapp:static') config.add_route('home', '/') config.add_view('pyramidapp.views.my_view', route_name='home', renderer='templates/mytemplate.pt') # pyramid_formalchemy's configuration config.include('pyramid_formalchemy') config.formalchemy_admin('admin', package='pyramidapp', factory=ModelsWithACL) # use the secure factory return config.make_wsgi_app()
def main(global_config, **settings): """ This function returns a Pyramid WSGI application. """ engine = engine_from_config(settings, 'sqlalchemy.') initialize_sql(engine) config = Configurator(settings=settings) config.add_static_view('static', 'pyramidapp:static') config.add_route('home', '/') config.add_view('pyramidapp.views.my_view', route_name='home', renderer='templates/mytemplate.pt') # pyramid_formalchemy's configuration config.include('pyramid_formalchemy') # register an admin UI config.formalchemy_admin('admin', package='pyramidapp') # register an admin UI for a single model config.formalchemy_model('foo', package='pyramidapp', model='pyramidapp.models.Foo') # register custom model listing config.formalchemy_model_view( 'admin', model='pyramidapp.models.Foo', context='pyramid_formalchemy.resources.ModelListing', renderer='templates/foolisting.pt', attr='listing', request_method='GET', permission='view') # register custom model view config.formalchemy_model_view( 'admin', model='pyramidapp.models.Foo', context='pyramid_formalchemy.resources.Model', name='', renderer='templates/fooshow.pt', attr='show', request_method='GET', permission='view') return config.make_wsgi_app()
def main(global_config, **settings): """ This function returns a Pyramid WSGI application. """ engine = engine_from_config(settings, 'sqlalchemy.') initialize_sql(engine) config = Configurator(settings=settings) config.add_static_view('static', 'pyramidapp:static') config.add_route('home', '/', view='pyramidapp.views.my_view', view_renderer='templates/mytemplate.pt') config.load_zcml('formalchemy:configure.zcml') config.add_route('fa_admin', '/admin/*traverse', factory='formalchemy.ext.pyramid.admin.AdminView') config.registry.settings.update({ 'fa.models': config.maybe_dotted('pyramidapp.models'), 'fa.forms': config.maybe_dotted('pyramidapp.forms'), 'fa.session_factory': config.maybe_dotted('pyramidapp.models.DBSession'), }) return config.make_wsgi_app()
def main(global_config, **settings): """ This function returns a Pyramid WSGI application. """ engine = engine_from_config(settings, 'sqlalchemy.') initialize_sql(engine) config = Configurator(settings=settings) config.add_static_view('static', 'pyramidapp:static') config.add_route('home', '/') config.add_view('pyramidapp.views.my_view', route_name='home', renderer='templates/mytemplate.pt') # pyramid_formalchemy's configuration config.include('pyramid_formalchemy') # register an admin UI config.formalchemy_admin('admin', package='pyramidapp') # register an admin UI for a single model config.formalchemy_model('foo', package='pyramidapp', model='pyramidapp.models.Foo') # register custom model listing config.formalchemy_model_view('admin', model='pyramidapp.models.Foo', context='pyramid_formalchemy.resources.ModelListing', renderer='templates/foolisting.pt', attr='listing', request_method='GET', permission='view') # register custom model view config.formalchemy_model_view('admin', model='pyramidapp.models.Foo', context='pyramid_formalchemy.resources.Model', name='', renderer='templates/fooshow.pt', attr='show', request_method='GET', permission='view') return config.make_wsgi_app()
def main(global_config, **settings): """ This function returns a Pyramid WSGI application. """ engine = engine_from_config(settings, "sqlalchemy.") initialize_sql(engine) # configure the security stuff config = Configurator( settings=settings, authentication_policy=RemoteUserAuthenticationPolicy(), authorization_policy=ACLAuthorizationPolicy(), ) config.add_static_view("static", "pyramidapp:static") config.add_route("home", "/", view="pyramidapp.views.my_view", view_renderer="templates/mytemplate.pt") # pyramid_formalchemy's configuration config.include("pyramid_formalchemy") config.formalchemy_admin("admin", package="pyramidapp", factory=ModelsWithACL) # use the secure factory return config.make_wsgi_app()
def _initTestingDB(): from sqlalchemy import create_engine from pyramidapp.models import initialize_sql session = initialize_sql(create_engine('sqlite://')) return session