@ -5,9 +5,24 @@ import flask
import flask_bootstrap
import flask_bootstrap
from mailu import utils , debug , models , manage , configuration
from mailu import utils , debug , models , manage , configuration
from gunicorn import glogging
import logging
import hmac
import hmac
class NoPingFilter ( logging . Filter ) :
def filter ( self , record ) :
if not ( record . args [ ' {host} i ' ] == ' localhost ' and record . args [ ' r ' ] == ' GET /ping HTTP/1.1 ' ) :
return True
class Logger ( glogging . Logger ) :
def setup ( self , cfg ) :
super ( ) . setup ( cfg )
# Add filters to Gunicorn logger
logger = logging . getLogger ( " gunicorn.access " )
logger . addFilter ( NoPingFilter ( ) )
def create_app_from_config ( config ) :
def create_app_from_config ( config ) :
""" Create a new application based on the given configuration
""" Create a new application based on the given configuration
"""
"""
@ -69,6 +84,10 @@ def create_app_from_config(config):
def format_datetime ( value ) :
def format_datetime ( value ) :
return utils . flask_babel . format_datetime ( value ) if value else ' '
return utils . flask_babel . format_datetime ( value ) if value else ' '
def ping ( ) :
return ' '
app . route ( ' /ping ' ) ( ping )
# Import views
# Import views
from mailu import ui , internal , sso
from mailu import ui , internal , sso
app . register_blueprint ( ui . ui , url_prefix = app . config [ ' WEB_ADMIN ' ] )
app . register_blueprint ( ui . ui , url_prefix = app . config [ ' WEB_ADMIN ' ] )