#NEWLINE# def includeme( config ) : #NEWLINE# #INDENT# from . generators import generate_server , generate_models #NEWLINE# Settings = dictset ( config . registry . settings ) #NEWLINE# config . include ( 'nefertari.engine' ) #NEWLINE# config . registry . database_acls = Settings . asbool ( 'database_acls' ) #NEWLINE# if config . registry . database_acls : #NEWLINE# #INDENT# config . include ( 'nefertari_guards' ) #NEWLINE# #UNINDENT# config . include ( 'nefertari' ) #NEWLINE# config . include ( 'nefertari.view' ) #NEWLINE# config . include ( 'nefertari.json_httpexceptions' ) #NEWLINE# if Settings . asbool ( 'enable_get_tunneling' ) : #NEWLINE# #INDENT# config . add_tween ( 'nefertari.tweens.get_tunneling' ) #NEWLINE# #UNINDENT# if Settings . asbool ( 'cors.enable' ) : #NEWLINE# #INDENT# config . add_tween ( 'nefertari.tweens.cors' ) #NEWLINE# #UNINDENT# if Settings . asbool ( 'ssl_middleware.enable' ) : #NEWLINE# #INDENT# config . add_tween ( 'nefertari.tweens.ssl' ) #NEWLINE# #UNINDENT# if Settings . asbool ( 'request_timing.enable' ) : #NEWLINE# #INDENT# config . add_tween ( 'nefertari.tweens.request_timing' ) #NEWLINE# #UNINDENT# config . root_factory = NefertariRootACL #NEWLINE# root = config . get_root_resource ( ) #NEWLINE# root_auth = getattr ( root , 'auth' , False ) #NEWLINE# log . info ( 'Parsing RAML' ) #NEWLINE# raml_root = ramlfications . parse ( Settings [ 'ramses.raml_schema' ] ) #NEWLINE# log . info ( 'Starting models generation' ) #NEWLINE# generate_models ( config , raml_resources = raml_root . resources ) #NEWLINE# if Settings : #NEWLINE# #INDENT# from . auth import setup_auth_policies , get_authuser_model #NEWLINE# if ( getattr ( config . registry , 'auth_model' , None ) is None ) : #NEWLINE# #INDENT# config . registry . auth_model = get_authuser_model ( ) #NEWLINE# #UNINDENT# setup_auth_policies ( config , raml_root ) #NEWLINE# #UNINDENT# config . include ( 'nefertari.elasticsearch' ) #NEWLINE# log . info ( 'Starting server generation' ) #NEWLINE# generate_server ( raml_root , config ) #NEWLINE# log . info ( 'Running nefertari.engine.setup_database' ) #NEWLINE# from nefertari.engine import setup_database #NEWLINE# setup_database ( config ) #NEWLINE# from nefertari.elasticsearch import ES #NEWLINE# ES . setup_mappings ( ) #NEWLINE# if root_auth : #NEWLINE# #INDENT# config . include ( 'ramses.auth' ) #NEWLINE# #UNINDENT# log . info ( 'Server succesfully generated\n' )