Ejemplo n.º 1
0
def index():
    '''
    Главная страница.
    '''
    processor = AdvertProcessor()
    aggregated = processor.get_aggregated()
    graph_url = url_for('graph', type=request.args.get('type') or 'all', district=request.args.get('district') or 'all',
                        floor_number=request.args.get('floor_number') or 0, room_count=request.args.get('room_count') or 0)
    return render_template('index.html', debug=settings.DEBUG, aggregated=aggregated, graph_url=graph_url)
Ejemplo n.º 2
0
def _validate_graph_params(params):
    '''
    Проверяет параметры графика.
    '''
    processor = AdvertProcessor()
    aggregated = processor.get_aggregated()
    if not _validate_graph_param(aggregated, params, 'type', 'all'):
        return False
    if not _validate_graph_param(aggregated, params, 'district', 'all'):
        return False
    if not _validate_graph_param(aggregated, params, 'floor_number', 0):
        return False
    if not _validate_graph_param(aggregated, params, 'room_count', 0):
        return False
    return True