From 1431b36c4a226dc9b57a3334364a0c40162c388f Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 29 Apr 2012 21:15:02 +1200 Subject: Preview in web application. --- libpathod/utils.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'libpathod/utils.py') 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 -- cgit v1.2.3