コード例 #1
0
ファイル: services.py プロジェクト: ashokks/open311
def _json_formatter_req(*args, **kwargs):
    content = []
    access_service_obj = AccessService(engine_config)
    type = kwargs.pop('type')

    if(type == 'post'):
        form = kwargs.pop('form')
        post_service_requests = access_service_obj.postServiceRequests(form)
        content.append(post_service_requests)

    else:
        args = kwargs.pop('args')
        get_service_requests = access_service_obj.getServiceRequests(args)
        for request in get_service_requests:
            content.append(request)

    return json.dumps(content)
コード例 #2
0
ファイル: services.py プロジェクト: ashokks/open311
def _xml_formatter_req(*args, **kwargs):
    root = XML('service_requests')
    access_service_obj = AccessService(engine_config)
    type = kwargs.pop('type')
    subroot = XML('request')

    if(type == 'post'):
        form = kwargs.pop('form')
        post_service_requests = access_service_obj.postServiceRequests(form)
        subroot.append_dict(post_service_requests)
    else:
        args = kwargs.pop('args')
        get_service_requests = access_service_obj.getServiceRequests(args)
        for request in get_service_requests:
            subroot.append_dict(request)

    root.append(subroot)
    return repr(root)