|
Revision 1992
(checked in by fumanchu, 5 months ago)
|
Test for #829 (@tools.response.headers doesn't appear to work with response.stream True).
|
- Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 |
"""Test module for Python 2.5-specific syntax, like the @-decorator syntax.""" |
|---|
| 2 |
|
|---|
| 3 |
from cherrypy import expose, tools |
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
class ExposeExamples(object): |
|---|
| 7 |
|
|---|
| 8 |
@expose |
|---|
| 9 |
def no_call(self): |
|---|
| 10 |
return "Mr E. R. Bradshaw" |
|---|
| 11 |
|
|---|
| 12 |
@expose() |
|---|
| 13 |
def call_empty(self): |
|---|
| 14 |
return "Mrs. B.J. Smegma" |
|---|
| 15 |
|
|---|
| 16 |
@expose("call_alias") |
|---|
| 17 |
def nesbitt(self): |
|---|
| 18 |
return "Mr Nesbitt" |
|---|
| 19 |
|
|---|
| 20 |
@expose(["alias1", "alias2"]) |
|---|
| 21 |
def andrews(self): |
|---|
| 22 |
return "Mr Ken Andrews" |
|---|
| 23 |
|
|---|
| 24 |
@expose(alias="alias3") |
|---|
| 25 |
def watson(self): |
|---|
| 26 |
return "Mr. and Mrs. Watson" |
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
class ToolExamples(object): |
|---|
| 30 |
|
|---|
| 31 |
@expose |
|---|
| 32 |
@tools.response_headers(headers=[('Content-Type', 'application/data')]) |
|---|
| 33 |
def blah(self): |
|---|
| 34 |
yield "blah" |
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
blah._cp_config['response.stream'] = True |
|---|
| 39 |
|
|---|
| 40 |
|
|---|