Beispiel #1
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 = findVersions()
        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,
                "global_config": serialized_config
            },
            RequestContext(request, {}),
        )
Beispiel #2
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.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, {}),
        )
Beispiel #3
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 = findVersions()
        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, "global_config": serialized_config},
            RequestContext(request, {}),
        )
Beispiel #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.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, {}),
        )