From 495daf2b641d14bbe8d7cab1482e12e8c8d7ea1b Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Fri, 5 Oct 2012 11:14:17 +1300 Subject: [PATCH] Remove actions log and explain, preparing for a more sophisticated take on this. --- libpathod/language.py | 18 ++---------------- libpathod/pathoc.py | 7 ------- test/test_pathoc.py | 6 +----- 3 files changed, 3 insertions(+), 28 deletions(-) diff --git a/libpathod/language.py b/libpathod/language.py index 53878b976..960e9d178 100644 --- a/libpathod/language.py +++ b/libpathod/language.py @@ -25,18 +25,6 @@ class ParseException(Exception): return "%s at char %s"%(self.msg, self.col) -def actions_log(lst): - ret = [] - for i in lst: - if i[1] == "inject": - ret.append( - [i[0], i[1], repr(i[2])] - ) - else: - ret.append(i) - return ret - - def ready_actions(length, lst): ret = [] for i in lst: @@ -620,7 +608,6 @@ class Message: err.serve(fp) return dict( disconnect = True, - actions = actions_log(actions), error = ret ) disconnect = write_values(fp, vals, actions[:]) @@ -629,7 +616,6 @@ class Message: disconnect = disconnect, started = started, duration = duration, - actions = actions_log(actions), ) for i in self.logattrs: v = getattr(self, i) @@ -656,8 +642,8 @@ class Response(Message): logattrs = ["code", "version", "body"] def __init__(self): Message.__init__(self) - self.code = 200 - self.msg = LiteralGenerator(http_status.RESPONSES[self.code]) + self.code = None + self.msg = None def preamble(self): return [self.version, " ", str(self.code), " ", self.msg] diff --git a/libpathod/pathoc.py b/libpathod/pathoc.py index bab568ca1..3ed091901 100644 --- a/libpathod/pathoc.py +++ b/libpathod/pathoc.py @@ -83,13 +83,6 @@ class Pathoc(tcp.TCPClient): if req: if ignorecodes and resp and resp[1] in ignorecodes: return - if explain: - print >> fp, ">>", req["method"], repr(req["path"]) - for a in req["actions"]: - print >> fp, "\t", - for x in a: - print >> fp, x, - print >> fp if showreq: self._show(fp, ">> Request", self.wfile.get_log(), hexdump) diff --git a/test/test_pathoc.py b/test/test_pathoc.py index 1c64f076f..bec339cb6 100644 --- a/test/test_pathoc.py +++ b/test/test_pathoc.py @@ -75,12 +75,8 @@ class TestDaemon: def test_conn_err(self): assert "Invalid server response" in self.tval(["get:'/p/200:d2'"]) - def test_explain(self): - reqs = [ "get:/api/info:ir,'x'"] - assert "inject" in self.tval(reqs, explain=True) - def test_fileread(self): d = tutils.test_data.path("data/request") - assert "foo" in self.tval(["+%s"%d], explain=True) + assert "foo" in self.tval(["+%s"%d], showreq=True) assert "File" in self.tval(["+/nonexistent"])