예제 #1
0
파일: views.py 프로젝트: johan--/texcavator
def index(request):
    """Render main page."""

    from services.es import _KB_DISTRIBUTION_VALUES, _KB_ARTICLE_TYPE_VALUES

    config_reverse_mapping = {"sd": flip_dict(_KB_DISTRIBUTION_VALUES), "st": flip_dict(_KB_ARTICLE_TYPE_VALUES)}

    date_limits = daterange2dates(settings.TEXCAVATOR_DATE_RANGE)

    data = {
        "PROJECT_NAME": settings.PROJECT_NAME,
        "PROJECT_MIN_DATE": date_limits[0]["lower"],
        "PROJECT_MAX_DATE": date_limits[0]["upper"],
        "QUERY_DATA_DOWNLOAD_ALLOW": settings.QUERY_DATA_DOWNLOAD_ALLOW,
        "ES_INDEX": settings.ES_INDEX,
        "ES_REVERSE_MAPPING": json.dumps(config_reverse_mapping),
        "ILPS_LOGGING": settings.ILPS_LOGGING,
    }

    return render_to_response("index.html", data, RequestContext(request))
예제 #2
0
def test_flip_dict():
    example = {'1': 'one', '2': 'two'}
    result = utils.flip_dict(example)
    assert_equals(result, {'one': '1', 'two': '2'})
def test_flip_dict():
    example = {'1': 'one', '2': 'two'}
    result = utils.flip_dict(example)
    assert_equals(result, {'one': '1', 'two': '2'})