scout/server/app.py
def configure_coverage(app):
    """Setup coverage related extensions."""
    # setup chanjo report
    app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True if app.debug else False
    if chanjo_api:
        chanjo_api.init_app(app)
        configure_template_filters(app)
        # register chanjo report blueprint
        app.register_blueprint(report_bp, url_prefix='/reports')

    babel = Babel(app)

    @babel.localeselector
    def get_locale():
        """Determine locale to use for translations."""
        accept_languages = current_app.config.get('ACCEPT_LANGUAGES', ['en'])

        # first check request args
        session_language = request.args.get('lang')
        if session_language in accept_languages:
            current_app.logger.info("using session language: %s", session_language)
            return session_language

        # language can be forced in config
        user_language = current_app.config.get('REPORT_LANGUAGE')
        if user_language:
            return user_language

        # try to guess the language from the user accept header that
        # the browser transmits.  We support de/fr/en in this example.
        # The best match wins.
        return request.accept_languages.best_match(accept_languages)
def configure_coverage(app):
    # setup chanjo report
    app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True if app.debug else False
    if chanjo_api:
        chanjo_api.init_app(app)
        configure_template_filters(app)
        # register chanjo report blueprint
        app.register_blueprint(report_bp, url_prefix='/reports')

    babel = Babel(app)

    @babel.localeselector
    def get_locale():
        """Determine locale to use for translations."""
        accept_languages = current_app.config.get('ACCEPT_LANGUAGES', ['en'])

        # first check request args
        session_language = request.args.get('lang')
        if session_language in accept_languages:
            current_app.logger.info("using session language: %s", session_language)
            return session_language

        # language can be forced in config
        user_language = current_app.config.get('REPORT_LANGUAGE')
        if user_language:
            return user_language

        # try to guess the language from the user accept header that
        # the browser transmits.  We support de/fr/en in this example.
        # The best match wins.
        return request.accept_languages.best_match(accept_languages)
def configure_coverage ( app ) : # setup chanjo report app . config [ 'SQLALCHEMY_TRACK_MODIFICATIONS' ] = True if app . debug else False if chanjo_api : chanjo_api . init_app ( app ) configure_template_filters ( app ) # register chanjo report blueprint app . register_blueprint ( report_bp , url_prefix = '/reports' ) babel = Babel ( app ) @ babel . localeselector def get_locale ( ) : """Determine locale to use for translations.""" accept_languages = current_app . config . get ( 'ACCEPT_LANGUAGES' , [ 'en' ] ) # first check request args session_language = request . args . get ( 'lang' ) if session_language in accept_languages : current_app . logger . info ( "using session language: %s" , session_language ) return session_language # language can be forced in config user_language = current_app . config . get ( 'REPORT_LANGUAGE' ) if user_language : return user_language # try to guess the language from the user accept header that # the browser transmits.  We support de/fr/en in this example. # The best match wins. return request . accept_languages . best_match ( accept_languages )
Setup coverage related extensions.
Setup coverage related extensions .