Exemplo n.º 1
0
    def post_json(self, params):
        files = params.FILES.getlist('file')
        errors = []
        success = True

        for f in files:
            suc, err= GedcomFileImporter().parse(f)
            if err:
                errors.append(err)
            success = success or suc

        graph.mark_as_invalid()   # Will need a refresh
        return {'error': "\n\n".join(errors), 'success': success}
Exemplo n.º 2
0
def import_gedcom(request):
    # params = json.loads(request.body)  # parse angularJS JSON parameters
    try:
        print "MANU import_gedcom FILES=%s", request.FILES
        data = request.FILES['file']
        #data = params['file']
        success, errors = GedcomFileImporter().parse(data)
        graph.mark_as_invalid()   # Will need a refresh
        resp = {'error': errors, 'success': success}
    except KeyError:
        resp = {'error': 'No file specified', 'success': False}

    return HttpResponse(to_json(resp), content_type='application/json')
Exemplo n.º 3
0
def import_gedcom(request):
    # params = json.loads(request.body)  # parse angularJS JSON parameters
    try:
        print "MANU import_gedcom FILES=%s", request.FILES
        data = request.FILES['file']
        #data = params['file']
        success, errors = GedcomFileImporter().parse(data)
        graph.mark_as_invalid()  # Will need a refresh
        resp = {'error': errors, 'success': success}
    except KeyError:
        resp = {'error': 'No file specified', 'success': False}

    return HttpResponse(to_json(resp), content_type='application/json')
Exemplo n.º 4
0
def import_gedcom(request):
    try:
        data = request.FILES['file']
    except KeyError:
        return redirect('/')

    success, errors = GedcomFileImporter().parse(data)

    graph.mark_as_invalid()   # Will need a refresh

    return render_to_response(
        'geneaprove/importer.html',
        {'error': errors,
         'success': success},
        context_instance=RequestContext(request))