コード例 #1
0
ファイル: views.py プロジェクト: Makdaam/ralph
def preboot_raw_view(request, file_name):
    try:
        deployment = get_current_deployment(request)
        pbf = deployment.preboot.files.get(name=file_name)
        return get_response(pbf)
    except (AttributeError, Deployment.DoesNotExist, PrebootFile.DoesNotExist,
        PrebootFile.MultipleObjectsReturned):
        pass
    if file_name in ('boot', 'boot_ipxe', 'boot.ipxe'):
        return render(request, 'deployment/localboot.txt', locals(),
            mimetype='text/plain')
    return HttpResponseNotFound()
コード例 #2
0
ファイル: views.py プロジェクト: Makdaam/ralph
def preboot_type_view(request, file_type):
    try:
        ftype = FileType.from_name(file_type)
    except ValueError:
        return HttpResponseNotFound()
    try:
        deployment = get_current_deployment(request)
        pbf = deployment.preboot.files.get(ftype=ftype)
        return get_response(pbf)
    except (AttributeError, Deployment.DoesNotExist, PrebootFile.DoesNotExist,
        PrebootFile.MultipleObjectsReturned):
        pass
    if ftype is FileType.boot_ipxe:
        return render(request, 'deployment/localboot.txt', locals(),
            mimetype='text/plain')
    return HttpResponseNotFound()
コード例 #3
0
ファイル: views.py プロジェクト: ReJeCtAll/ralph
def show_ventures(request, venture_id=None):
    if venture_id == 'search':
        if request.method != 'POST':
            return redirect(request, '/business/ventures/')
        search = request.POST['search']
        if not search:
            return redirect(request, '/business/ventures/')
        template = 'business/show_ventures.html'
        ventures = Venture.objects.filter(name__icontains=search).order_by(
            'name')
    elif venture_id:
        venture = Venture.objects.get(pk=venture_id)
        subventures = Venture.objects.filter(parent=venture).order_by('name')
        template = 'business/show_venture.html'
    else:
        ventures = Venture.objects.filter(parent=None).order_by('name')
        template = 'business/show_ventures.html'
    side_ventures = Venture.objects.filter(parent=None).order_by('name')
    synergy_url_base = SYNERGY_URL_BASE
    return render(request, template, locals())