diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2012-04-29 21:15:02 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2012-04-29 21:15:02 +1200 |
commit | 1431b36c4a226dc9b57a3334364a0c40162c388f (patch) | |
tree | a2e65e7cecad73c6e579ef63c3358f5baa4afb78 /libpathod/utils.py | |
parent | 37e880b3990e2729d857b0f3a24f80d45116b7f0 (diff) | |
download | mitmproxy-1431b36c4a226dc9b57a3334364a0c40162c388f.tar.gz mitmproxy-1431b36c4a226dc9b57a3334364a0c40162c388f.tar.bz2 mitmproxy-1431b36c4a226dc9b57a3334364a0c40162c388f.zip |
Preview in web application.
Diffstat (limited to 'libpathod/utils.py')
-rw-r--r-- | libpathod/utils.py | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/libpathod/utils.py b/libpathod/utils.py index daeccdea..6d42c9b2 100644 --- a/libpathod/utils.py +++ b/libpathod/utils.py @@ -1,8 +1,34 @@ -import copy, os, re +import copy, os, re, StringIO import rparse class AnchorError(Exception): pass + +class Sponge: + def __getattr__(self, x): + return Sponge() + + def __call__(self, *args, **kwargs): + pass + + +class DummyRequest: + connection = Sponge() + def __init__(self): + self.buf = [] + + def write(self, d, callback=None): + self.buf.append(str(d)) + if callback: + callback() + + def getvalue(self): + return "".join(self.buf) + + def finish(self): + return + + def parse_anchor_spec(s, settings): """ For now, this is very simple, and you can't have an '=' in your regular |