import re
import cPickle as pickle
from django.utils import simplejson as json
from test_utils.testmaker import setup_logging
from test_utils.testmaker.base_processor import Processer

in_file = '/Users/ericholscher/lib/artocrats/pieces/tests/pieces_testdata.pickle'
f = open(in_file)

buffer = []

req_re = re.compile('---REQUEST_BREAK---')
res_re = re.compile('---RESPONSE_BREAK---')

processor = Processer()

setup_logging('/Users/ericholscher/lib/artocrats/pieces/tests/redo.py', '/dev/null')

serial_obj = json

class Request(dict):
    'Mocking a dict to allow attribute access'
    def __getattr__(self, name):
        return self[name]

for line in f.readlines():
    if req_re.search(line):
        #process request
        to_pickle = ''.join(buffer)
        request = Request(serial_obj.loads(to_pickle))
        processor.log_request(request)
        print request['path'], request['time']
        buffer = []
    elif res_re.search(line):
        #process response
        to_pickle = ''.join(buffer)
        response = Request(serial_obj.loads(to_pickle))
        self.processer.process_response(request, response)
        print response['status_code'], response['time']
        buffer = []
    else:
        buffer.append(line)

@@ -1,12 +1,23 @@
+import sys%0A
 import re%0Aim
@@ -116,29 +116,25 @@
  import 
-setup_logging
+Testmaker
 %0Afrom te
@@ -156,12 +156,25 @@
 ker.
-base
+processors.django
 _pro
@@ -198,93 +198,105 @@
 cess
-e
+o
 r%0A%0Ai
-n_file = '/Users/ericholscher/lib/artocrats/pieces/tests/pieces_testdata.pickle'
+f len(sys.argv) == 2:%0A    in_file = sys.argv%5B1%5D%0Aelse:%0A    raise Exception('Need file name')%0A
 %0Af =
@@ -435,14 +435,52 @@
 cess
+or('replay_processor')%0Atm = Testmak
 er()%0A%0A
+tm.
 setu
@@ -494,62 +494,19 @@
 ng('
-/Users/ericholscher/lib/artocrats/pieces/tests/redo.py
+replay_file
 ', '
@@ -531,20 +531,22 @@
 l_obj = 
-json
+pickle
 %0A%0Aclass 
@@ -856,19 +856,20 @@
 ocessor.
-log
+save
 _request
@@ -1105,30 +1105,22 @@
     
-self.processer.
 process
+er.save
 _res

Fix replay functionality. This should be more robust.