예제 #1
0
def initial(request):

    version_info = None
    authentication_info = None

    try:

        # Get version and build date
        version_info = _get_server_version_info().__dict__

        # Get auth info
        auth_info = _get_user_auth_info(request.user)

        # Construct response
        resp = dict(
            version_info=version_info,
            auth_info=auth_info
        )

    except Exception:

        logger.error(request._get_request)
        logger.exception('An error occured:')

    return HttpResponse(json.dumps(resp, sort_keys=False), mimetype='application/json')
예제 #2
0
def get_user_auth_info(request):

    user_auth_info = {}

    try:

        user_auth_info = _get_user_auth_info(request.user)

    except Exception:

        logger.error(request._get_request)
        logger.exception('An error occured:')

    return HttpResponse(json.dumps(user_auth_info, sort_keys=False), mimetype='application/json')