supported modes missing debug_write
[pyTivo.git] / Cheetah / DummyTransaction.py
blob8ebe33d286e235eb9ba0f7f0047e350ffb226d39
1 #!/usr/bin/env python
2 # $Id: DummyTransaction.py,v 1.13 2005/11/13 01:12:13 tavis_rudd Exp $
4 """Provides dummy Transaction and Response classes is used by Cheetah in place
5 of real Webware transactions when the Template obj is not used directly as a
6 Webware servlet.
8 Meta-Data
9 ==========
10 Author: Tavis Rudd <tavis@damnsimple.com>
11 Version: $Revision: 1.13 $
12 Start Date: 2001/08/30
13 Last Revision Date: $Date: 2005/11/13 01:12:13 $
14 """
15 __author__ = "Tavis Rudd <tavis@damnsimple.com>"
16 __revision__ = "$Revision: 1.13 $"[11:-2]
18 def flush():
19 pass
21 class DummyResponse:
23 """A dummy Response class is used by Cheetah in place of real Webware
24 Response objects when the Template obj is not used directly as a Webware
25 servlet. """
28 def __init__(self):
29 self._outputChunks = outputChunks = []
30 self.write = write = outputChunks.append
31 def getvalue(outputChunks=outputChunks):
32 return ''.join(outputChunks)
33 self.getvalue = getvalue
35 def writeln(txt):
36 write(txt)
37 write('\n')
38 self.writeln = writeln
39 self.flush = flush
41 def writelines(self, *lines):
42 ## not used
43 [self.writeln(ln) for ln in lines]
45 class DummyTransaction:
47 """A dummy Transaction class is used by Cheetah in place of real Webware
48 transactions when the Template obj is not used directly as a Webware
49 servlet.
51 It only provides a response object and method. All other methods and
52 attributes make no sense in this context.
53 """
55 def __init__(self, DummyResponse=DummyResponse):
56 def response(resp=DummyResponse()):
57 return resp
58 self.response = response