Commits

Rune Halvorsen committed e5668cc

Use loads/dumps rather than serialize/deserialize

Comments (0)

Files changed (1)

 # the environment. First a message to select json as default payload format
 # and then two messages to enable the exec and window manager services
 # as default format for payloads
-server.send("scope", 3, 1, tags.next(), serialize(["json"]))
-server.send("scope", 5, 1, tags.next(), serialize(["exec"]))
-server.send("scope", 5, 1, tags.next(), serialize(["window-manager"]))
+server.send("scope", 3, 1, tags.next(), dumps(["json"]))
+server.send("scope", 5, 1, tags.next(), dumps(["exec"]))
+server.send("scope", 5, 1, tags.next(), dumps(["window-manager"]))
 
-server.send("exec", 2, 1, tags.next(), serialize([]))
+server.send("exec", 2, 1, tags.next(), dumps([]))
 
 
 
-server.send("exec", 1, 1, tags.next(), serialize([[["New page"]]]))
+server.send("exec", 1, 1, tags.next(), dumps([[["New page"]]]))
 
 # wait for an event from the window manager that tells us the id of the
 # newly created window
 event = wait_for_event(server, "window-manager", 4)
-payload = deserialize(event.payload)
+payload = loads(event.payload)
 windowid = payload[0]
 
 
 
 # Then send a message that opens a URL in a new tab
 # Open link in new page
-server.send("exec", 1, 1, tags.next(), serialize([[["Go", url, windowid]]]))
+server.send("exec", 1, 1, tags.next(), dumps([[["Go", url, windowid]]]))
 
 
 
     
     event = wait_for_event(server, "window-manager", 7)
     print event
-    if deserialize(event.payload)[0] == windowid:
+    if loads(event.payload)[0] == windowid:
         cnt+=1
         print "cnt", cnt
         #break
 
 tag = tags.next()
 # take the screenshot
-server.send("exec", 3, 1, tag, serialize(args))
+server.send("exec", 3, 1, tag, dumps(args))
 
 reply = wait_for_reply(server, tag)
-payload = deserialize(reply.payload)
+payload = loads(reply.payload)
 path = save_screenshot(payload[2])
 
 print "Saved screenshot as", path
 
 
-server.send("exec", 1, 1, tags.next(), serialize([[["Close page", "", windowid]]]))
+server.send("exec", 1, 1, tags.next(), dumps([[["Close page", "", windowid]]]))