Esempio n. 1
0
def project_import_refine(request, project_uuid):
    """ Imports data from refine to a project """
    if not request.user.is_superuser:
        return HttpResponse('Unauthorized', status=401)
    else:
        valid_post = False
        if request.method == 'POST':
            refine_project = False
            if 'refine_project' in request.POST:
                refine_project = request.POST['refine_project']
                valid_post = True
        if valid_post:
            ipr = ImportProjects()
            proj = ipr.get_project(project_uuid)
            if proj is not False:
                # the project actually exists
                irs = ImportRefineSource()
                result = irs.import_refine_to_project(refine_project,
                                                      project_uuid)
                json_output = json.dumps(result, indent=4, ensure_ascii=False)
                return HttpResponse(
                    json_output, content_type='application/json; charset=utf8')
            else:
                raise Http404
        else:
            return HttpResponseForbidden
Esempio n. 2
0
def project_import_refine(request, project_uuid):
    """ Imports data from refine to a project """
    if not request.user.is_superuser:
        return HttpResponse('Unauthorized', status=401)
    else:
        valid_post = False
        if request.method == 'POST':
            refine_project = False
            if 'refine_project' in request.POST:
                refine_project = request.POST['refine_project']
                valid_post = True
        if valid_post:
            ipr = ImportProjects()
            proj = ipr.get_project(project_uuid)
            if proj is not False:
                # the project actually exists
                irs = ImportRefineSource()
                result = irs.import_refine_to_project(refine_project,
                                                      project_uuid)
                json_output = json.dumps(result,
                                         indent=4,
                                         ensure_ascii=False)
                return HttpResponse(json_output,
                                    content_type='application/json; charset=utf8')
            else:
                raise Http404
        else:
            return HttpResponseForbidden
Esempio n. 3
0
def project(request, project_uuid):
    """ Show HTML form for importing sources to a project """
    if not request.user.is_superuser:
        return HttpResponse('Unauthorized', status=401)
    else:
        ipr = ImportProjects()
        proj = ipr.get_project(project_uuid)
        if proj is not False:
            imnav = ImportNavigation()
            proj['nav'] = imnav.set_nav('project', project_uuid, False)
            template = loader.get_template('imports/project.html')
            context = RequestContext(request, {'proj': proj})
            return HttpResponse(template.render(context))
        else:
            raise Http404
Esempio n. 4
0
def project(request, project_uuid):
    """ Show HTML form for importing sources to a project """
    if not request.user.is_superuser:
        return HttpResponse('Unauthorized', status=401)
    else:
        ipr = ImportProjects()
        proj = ipr.get_project(project_uuid)
        if proj is not False:
            imnav = ImportNavigation()
            proj['nav'] = imnav.set_nav('project',
                                        project_uuid,
                                        False)
            template = loader.get_template('imports/project.html')
            context = RequestContext(request,
                                     {'proj': proj})
            return HttpResponse(template.render(context))
        else:
            raise Http404
Esempio n. 5
0
def project(request, project_uuid):
    """ Show HTML form for importing sources to a project """
    if not request.user.is_superuser:
        return HttpResponse('Unauthorized', status=401)
    else:
        rp = RootPath()
        base_url = rp.get_baseurl()
        ipr = ImportProjects()
        proj = ipr.get_project(project_uuid)
        if proj is not False:
            imnav = ImportNavigation()
            proj['nav'] = imnav.set_nav('project', project_uuid, False)
            template = loader.get_template('imports/project.html')
            context = {
                'proj': proj,
                'base_url': base_url,
                'user': request.user
            }
            return HttpResponse(template.render(context, request))
        else:
            raise Http404
Esempio n. 6
0
def project(request, project_uuid):
    """ Show HTML form for importing sources to a project """
    if not request.user.is_superuser:
        return HttpResponse('Unauthorized', status=401)
    else:
        rp = RootPath()
        base_url = rp.get_baseurl()
        ipr = ImportProjects()
        proj = ipr.get_project(project_uuid)
        if proj is not False:
            imnav = ImportNavigation()
            proj['nav'] = imnav.set_nav('project',
                                        project_uuid,
                                        False)
            template = loader.get_template('imports/project.html')
            context = {
                'proj': proj,
                'base_url': base_url,
                'user': request.user
            }
            return HttpResponse(template.render(context, request))
        else:
            raise Http404