예제 #1
0
파일: admin.py 프로젝트: skner/TS
def update(request):
    """provide a simple interface to allow Torrent Suite to be updated"""

    if request.method=="POST":
        updateLocked = run_update()
        data = json.dumps({"lockBlocked" : updateLocked })
        return http.HttpResponse(data, content_type="application/json")
    elif request.method=="GET":
        about, meta_version = findUpdates()
        # don't use cached method here, update page needs current info
        config = GlobalConfig.objects.filter()[0]
        config_dict = model_to_dict(config)
        try:
            # Disable Update Server button for some reason
            # Checking root partition for > 1GB free
            allow_update = True if files.getSpaceKB("/") > 1048576 else False
            if not allow_update:
                GlobalConfig.objects.update(ts_update_status="Insufficient disk space")
            else:
                if config.ts_update_status in "Insufficient disk space":
                    GlobalConfig.objects.update(ts_update_status="No updates")
        except:
            allow_update = True

        return render_to_response(
            "admin/update.html",
            {"about": about, "meta": meta_version,
             "show_available": config.ts_update_status not in ['No updates', 'Finished installing'],
             "global_config_json": json.dumps(config_dict),
             "allow_update": allow_update},
            RequestContext(request, {}),
        )
예제 #2
0
파일: admin.py 프로젝트: zjwang6/TS
def update(request):
    """provide a simple interface to allow Torrent Suite to be updated"""

    if request.method == "POST":
        updateLocked = run_update()
        data = json.dumps({"lockBlocked": updateLocked})
        return http.HttpResponse(data, content_type="application/json")
    elif request.method == "GET":
        about, meta_version = findUpdates()
        config = GlobalConfig.objects.filter()[0]
        config_dict = model_to_dict(config)
        eula_content, isValid, errorMsg = get_EULA_text()

        try:
            # Disable Update Server button for some reason
            # Checking root partition for > 1GB free
            allow_update = (files.getSpaceKB("/") > 1048576
                            and files.getSpaceKB("/var") > 1048576)
            if not allow_update:
                GlobalConfig.objects.update(
                    ts_update_status="Insufficient disk space")
            else:
                if config.ts_update_status in "Insufficient disk space":
                    GlobalConfig.objects.update(ts_update_status="No updates")
        except Exception:
            allow_update = True

        return render_to_response(
            "admin/update.html",
            {
                "about":
                about,
                "meta":
                meta_version,
                "show_available":
                config.ts_update_status
                not in ["No updates", "Finished installing"],
                "eula_content":
                eula_content,
                "eula_error":
                errorMsg,
                "global_config_json":
                json.dumps(config_dict),
                "maintenance_mode":
                maintenance_action("check")["maintenance_mode"],
                "allow_update":
                allow_update,
            },
            RequestContext(request, {}),
        )
예제 #3
0
파일: admin.py 프로젝트: dkeren/TS
def update(request):
    """provide a simple interface to allow Torrent Suite to be updated"""

    if request.method == "POST":
        updateLocked = run_update()
        data = json.dumps({"lockBlocked": updateLocked})
        return http.HttpResponse(data, content_type="application/json")
    elif request.method == "GET":
        about, meta_version = findUpdates()
        config = GlobalConfig.get()
        from iondb.rundb.api import GlobalConfigResource
        resource = GlobalConfigResource()
        bundle = Bundle(config)
        serialized_config = resource.serialize(None,
                                               resource.full_dehydrate(bundle),
                                               "application/json")

        try:
            # Disable Update Server button for some reason
            # Checking root partition for > 1GB free
            allow_update = True if files.getSpaceKB("/") > 1048576 else False
            if not allow_update:
                GlobalConfig.objects.update(
                    ts_update_status="Insufficient disk space")
            else:
                if GlobalConfig.objects.get(
                ).ts_update_status in "Insufficient disk space":
                    GlobalConfig.objects.update(ts_update_status="No updates")
        except:
            allow_update = True

        return render_to_response(
            "admin/update.html",
            {
                "about":
                about,
                "meta":
                meta_version,
                "show_available":
                config.ts_update_status
                not in ['No updates', 'Finished installing'],
                "global_config_json":
                serialized_config,
                "allow_update":
                allow_update
            },
            RequestContext(request, {}),
        )
예제 #4
0
def update(request):
    """provide a simple interface to allow Torrent Suite to be updated"""

    if request.method == "POST":
        updateLocked = run_update()
        data = json.dumps({"lockBlocked": updateLocked})
        return http.HttpResponse(data, content_type="application/json")
    elif request.method == "GET":
        about, meta_version = findUpdates()
        config = GlobalConfig.objects.filter()[0]
        config_dict = model_to_dict(config)
        try:
            # Disable Update Server button for some reason
            # Checking root partition for > 1GB free
            allow_update = True if files.getSpaceKB("/") > 1048576 else False
            if not allow_update:
                GlobalConfig.objects.update(
                    ts_update_status="Insufficient disk space")
            else:
                if config.ts_update_status in "Insufficient disk space":
                    GlobalConfig.objects.update(ts_update_status="No updates")
        except:
            allow_update = True

        return render_to_response(
            "admin/update.html",
            {
                "about":
                about,
                "meta":
                meta_version,
                "show_available":
                config.ts_update_status
                not in ['No updates', 'Finished installing'],
                "legacy_OS":
                findOSversion().get('RELEASE') == '10.04',
                "global_config_json":
                json.dumps(config_dict),
                "maintenance_mode":
                maintenance_action("check")['maintenance_mode'],
                "allow_update":
                allow_update
            },
            RequestContext(request, {}),
        )
예제 #5
0
파일: admin.py 프로젝트: LBragg/TS
def update(request):
    """provide a simple interface to allow Torrent Suite to be updated"""

    if request.method=="POST":
        updateLocked = run_update()
        data = json.dumps({"lockBlocked" : updateLocked })
        return http.HttpResponse(data, content_type="application/json")
    elif request.method=="GET":
        about, meta_version = findUpdates()
        config = GlobalConfig.get()
        from iondb.rundb.api import GlobalConfigResource
        resource = GlobalConfigResource()
        bundle = Bundle(config)
        serialized_config = resource.serialize(None,
                                               resource.full_dehydrate(bundle),
                                               "application/json")
        return render_to_response(
            "admin/update.html",
            {"about": about, "meta": meta_version,
             "show_available": config.ts_update_status not in ['No updates', 'Finished installing'],
             "global_config_json": serialized_config},
            RequestContext(request, {}),
        )
예제 #6
0
파일: admin.py 프로젝트: ameynert/TS
def update(request):
    """provide a simple interface to allow Torrent Suite to be updated"""

    if request.method=="POST":
        updateLocked = run_update()
        data = json.dumps({"lockBlocked" : updateLocked })
        return http.HttpResponse(data, content_type="application/json")
    elif request.method=="GET":
        about, meta_version = findUpdates()
        config = GlobalConfig.get()
        from iondb.rundb.api import GlobalConfigResource
        resource = GlobalConfigResource()
        bundle = Bundle(config)
        serialized_config = resource.serialize(None,
                                               resource.full_dehydrate(bundle),
                                               "application/json")

        try:
            # Disable Update Server button for some reason
            # Checking root partition for > 1GB free
            allow_update = True if files.getSpaceKB("/") > 1048576 else False
            if not allow_update:
                GlobalConfig.objects.update(ts_update_status="Insufficient disk space")
            else:
                if GlobalConfig.objects.get().ts_update_status in "Insufficient disk space":
                    GlobalConfig.objects.update(ts_update_status="No updates")
        except:
            allow_update = True

        return render_to_response(
            "admin/update.html",
            {"about": about, "meta": meta_version,
             "show_available": config.ts_update_status not in ['No updates', 'Finished installing'],
             "global_config_json": serialized_config,
             "allow_update": allow_update},
            RequestContext(request, {}),
        )