| Conditions | 3 | 
| Total Lines | 31 | 
| Code Lines | 16 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | import os  | 
            ||
| 10 | def main(global_config, **settings):  | 
            ||
| 11 | """This function returns a Pyramid WSGI application."""  | 
            ||
| 12 | |||
| 13 | # Set up sqlalchemy  | 
            ||
| 14 | engine = engine_from_config(settings, "sqlalchemy.")  | 
            ||
| 15 | Base.metadata.bind = engine  | 
            ||
| 16 | |||
| 17 | # update settings  | 
            ||
| 18 | settings["layout.focus_conceptschemes"] = aslist(  | 
            ||
| 19 | settings["layout.focus_conceptschemes"], flatten=False  | 
            ||
| 20 | )  | 
            ||
| 21 | |||
| 22 | # set up dump location  | 
            ||
| 23 | dump_location = settings["atramhasis.dump_location"]  | 
            ||
| 24 | if not os.path.exists(dump_location):  | 
            ||
| 25 | os.makedirs(dump_location)  | 
            ||
| 26 | |||
| 27 | with Configurator(settings=settings) as config:  | 
            ||
| 28 | # set default session factory  | 
            ||
| 29 | atramhasis_session_factory = SignedCookieSessionFactory(  | 
            ||
| 30 | settings["atramhasis.session_factory.secret"]  | 
            ||
| 31 | )  | 
            ||
| 32 | config.set_session_factory(atramhasis_session_factory)  | 
            ||
| 33 | |||
| 34 | # Set up atramhasis  | 
            ||
| 35 |         config.include("atramhasis") | 
            ||
| 36 | # Set up atramhasis db  | 
            ||
| 37 |         config.include("atramhasis:data.db") | 
            ||
| 38 | |||
| 39 | config.scan()  | 
            ||
| 40 | return config.make_wsgi_app()  | 
            ||
| 41 |