bugfix for [#23737] reported by Mariusz Maximus

netrender client's functions to get slaves and jobs info didn't work anymore (was reading response content twice).

At the same time, I switched to json for the dump and load, instead of using eval and repr (for obvious security reasons). I should have done this much earlier.
This commit is contained in:
2010-09-12 14:04:54 +00:00
parent 74059891e9
commit 797bb93b21
4 changed files with 19 additions and 15 deletions

View File

@@ -20,6 +20,7 @@ import bpy
import sys, os
import http, http.client, http.server, urllib, socket
import webbrowser
import json
import netrender
from netrender.utils import *
@@ -205,10 +206,10 @@ class RENDER_OT_netclientstatus(bpy.types.Operator):
conn.request("GET", "/status")
response = conn.getresponse()
response.read()
content = response.read()
print( response.status, response.reason )
jobs = (netrender.model.RenderJob.materialize(j) for j in eval(str(response.read(), encoding='utf8')))
jobs = (netrender.model.RenderJob.materialize(j) for j in json.loads(str(content, encoding='utf8')))
while(len(netsettings.jobs) > 0):
netsettings.jobs.remove(0)
@@ -307,10 +308,10 @@ class RENDER_OT_netclientslaves(bpy.types.Operator):
conn.request("GET", "/slaves")
response = conn.getresponse()
response.read()
content = response.read()
print( response.status, response.reason )
slaves = (netrender.model.RenderSlave.materialize(s) for s in eval(str(response.read(), encoding='utf8')))
slaves = (netrender.model.RenderSlave.materialize(s) for s in json.loads(str(content, encoding='utf8')))
while(len(netsettings.slaves) > 0):
netsettings.slaves.remove(0)