Configurator


Definition
A syntax is used to configure the application for browser.

Syntax
Configurator

Examples
The Response returns the union of frozenset x, y. 
from pyramid.response import Response

def frozenset1(request):
    x=frozenset({7,9,11,13})
    y=frozenset({5,10,15})
    z=frozenset.union(x,y)
    z=str(z)
    return Response('The union of frozenset is:' + z)
        
if __name__ == '__main__':
    config = Configurator()
    config.add_route('set', '/')
    config.add_view(frozenset1, route_name='set')
    app = config.make_wsgi_app()
    server = make_server('0.0.0.0', 1050, app)
    server.serve_forever()






The pyramid returns with the requests after finding the number of 'a' in www.pythonlake.com.
from wsgiref.simple_server import make_server
from pyramid.response import Response
import requests

def find(request):
    r=requests.get('http://www.pythonlake.com')
    text=r.text
    f=text.find('a')
    f=str(f)
    response = Response()
    response.text=f
    return response
    
if __name__ == '__main__':
    config = Configurator()
    config.add_route('find', '/')
    config.add_view(find, route_name='find')
    app = config.make_wsgi_app()
    server = make_server('0.0.0.0', 6500, app)
    server.serve_forever()





Configurator

  • .absolute_asset_spec
  • .absolute_resource_spec
  • .action
  • .action_info
  • .action_state
  • .add_default_renderers
  • .add_default_response_adapters
  • .add_default_route_predicates
  • .add_default_view_predicates
  • .add_directive
  • .add_forbidden_view
  • .add_notfound_view
  • .add_response_adapter
  • .add_route
  • .add_route_predicate
  • .add_route_predicate
  • .add_settings
  • .add_static_view
  • .add_subscriber
  • .add_subscriber_predicate
  • .add_translation_dirs
  • .add_traverser
  • .add_tween
  • .add_view
  • .add_view_predicate
  • .basepath
  • .begin
  • .commit
  • .derive_view
  • .end
  • .get_predlist
  • .get_routes_mapper
  • .get_settings
  • .hook_zca
  • .include
  • .includepath
  • .info
  • .inspect
  • .introspectable
  • .introspector
  • .make_wsgi_app
  • .manager
  • .maybe_dotted
  • .object_description
  • .override_asset
  • .override_resource
  • .scan
  • .set_authentication_policy
  • .set_authorization_policy
  • .set_default_permission
  • .set_forbidden_view
  • .set_locale_negotiator
  • .set_notfound_view
  • .set_request_factory
  • .set_root_factory
  • .set_session_factory
  • .set_view_mapper
  • .setup_registry
  • .testing_add_renderer
  • .testing_add_subscriber
  • .testing_add_template
  • .testing_models
  • .testing_resources
  • .testing_securitypolicy
  • .unhook_zca
  • .venusian
  • .with_package

Comments