コード例 #1
0
ファイル: req_process.py プロジェクト: mbarrerar/ADL_LRS
def agent_profile_get(req_dict):
    # add ETag for concurrency
    agent = req_dict['params']['agent']
    a = AgentManager(agent).Agent
    ap = AgentProfileManager(a)

    profileId = req_dict['params'].get('profileId',
                                       None) if 'params' in req_dict else None
    if profileId:
        resource = ap.get_profile(profileId)
        if resource.profile:
            response = HttpResponse(resource.profile.read(),
                                    content_type=resource.content_type)
        else:
            response = HttpResponse(resource.json_profile,
                                    content_type=resource.content_type)
        response['ETag'] = '"%s"' % resource.etag
        return response

    since = req_dict['params'].get('since',
                                   None) if 'params' in req_dict else None
    resource = ap.get_profile_ids(since)
    response = HttpResponse(json.dumps([k for k in resource]),
                            content_type="application/json")
    return response
コード例 #2
0
ファイル: req_process.py プロジェクト: 50Fresh/ADL_LRS
def agent_profile_delete(req_dict):
    agent = req_dict['params']['agent']
    a = AgentManager(agent).Agent
    profileId = req_dict['params']['profileId']
    ap = AgentProfileManager(a)
    ap.delete_profile(profileId)

    return HttpResponse('', status=204)
コード例 #3
0
ファイル: req_process.py プロジェクト: 50Fresh/ADL_LRS
def agent_profile_put(req_dict):
    # test ETag for concurrency
    agent = req_dict['params']['agent']
    a = AgentManager(agent).Agent
    ap = AgentProfileManager(a)
    ap.put_profile(req_dict)

    return HttpResponse("", status=204)
コード例 #4
0
ファイル: req_process.py プロジェクト: mbarrerar/ADL_LRS
def agent_profile_delete(req_dict):
    agent = req_dict['params']['agent']
    a = AgentManager(agent).Agent
    profileId = req_dict['params']['profileId']
    ap = AgentProfileManager(a)
    ap.delete_profile(profileId)

    return HttpResponse('', status=204)
コード例 #5
0
ファイル: req_process.py プロジェクト: mbarrerar/ADL_LRS
def agent_profile_put(req_dict):
    # test ETag for concurrency
    agent = req_dict['params']['agent']
    a = AgentManager(agent).Agent
    ap = AgentProfileManager(a)
    ap.put_profile(req_dict)

    return HttpResponse("", status=204)
コード例 #6
0
ファイル: req_process.py プロジェクト: 50Fresh/ADL_LRS
def agent_profile_get(req_dict):
    # add ETag for concurrency
    agent = req_dict['params']['agent']
    a = AgentManager(agent).Agent
    ap = AgentProfileManager(a)

    profileId = req_dict['params'].get('profileId', None) if 'params' in req_dict else None
    if profileId:
        resource = ap.get_profile(profileId)
        if resource.profile:
            response = HttpResponse(resource.profile.read(), content_type=resource.content_type)
        else:
            response = HttpResponse(resource.json_profile, content_type=resource.content_type)            
        response['ETag'] = '"%s"' % resource.etag
        return response

    since = req_dict['params'].get('since', None) if 'params' in req_dict else None
    resource = ap.get_profile_ids(since)
    response = HttpResponse(json.dumps([k for k in resource]), content_type="application/json")
    return response