Пример #1
0
def import_data_all(request):
    """
    Import the game world from an uploaded zip file.
    """
    response = http.HttpResponseNotModified()
    file_obj = request.FILES.get("import_data_all", None)

    if file_obj:
        with tempfile.TemporaryFile() as zipfile:
            try:
                for chunk in file_obj.chunks():
                    zipfile.write(chunk)
                importer.unzip_data_all(zipfile)
            except Exception, e:
                logger.log_errmsg("Cannot import game data. %s" % e)
                return render(request, 'fail.html', {"message": str(e)})
Пример #2
0
def import_data_all(request):
    """
    Import the game world from an uploaded zip file.
    """
    response = http.HttpResponseNotModified()
    file_obj = request.FILES.get("import_data_all", None)

    if file_obj:
        with tempfile.TemporaryFile() as zipfile:
            try:
                for chunk in file_obj.chunks():
                    zipfile.write(chunk)
                importer.unzip_data_all(zipfile)
            except Exception, e:
                logger.log_errmsg("Cannot import game data. %s" % e)
                return render(request, 'fail.html', {"message": str(e)})