| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 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. |
|---|
| 7 |
|
|---|
| 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] |
|---|
| 17 |
|
|---|
| 18 |
def flush(): |
|---|
| 19 |
pass |
|---|
| 20 |
|
|---|
| 21 |
class DummyResponse: |
|---|
| 22 |
|
|---|
| 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. """ |
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 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 |
|---|
| 34 |
|
|---|
| 35 |
def writeln(txt): |
|---|
| 36 |
write(txt) |
|---|
| 37 |
write('\n') |
|---|
| 38 |
self.writeln = writeln |
|---|
| 39 |
self.flush = flush |
|---|
| 40 |
|
|---|
| 41 |
def writelines(self, *lines): |
|---|
| 42 |
|
|---|
| 43 |
[self.writeln(ln) for ln in lines] |
|---|
| 44 |
|
|---|
| 45 |
class DummyTransaction: |
|---|
| 46 |
|
|---|
| 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. |
|---|
| 50 |
|
|---|
| 51 |
It only provides a response object and method. All other methods and |
|---|
| 52 |
attributes make no sense in this context. |
|---|
| 53 |
""" |
|---|
| 54 |
|
|---|
| 55 |
def __init__(self, DummyResponse=DummyResponse): |
|---|
| 56 |
def response(resp=DummyResponse()): |
|---|
| 57 |
return resp |
|---|
| 58 |
self.response = response |
|---|