Package cherrypy :: Package test :: Module _test_decorators
[hide private]
[frames] | no frames]

Source Code for Module cherrypy.test._test_decorators

 1  """Test module for the @-decorator syntax, which is version-specific""" 
 2   
 3  from cherrypy import expose, tools 
 4  from cherrypy._cpcompat import ntob 
5 6 7 -class ExposeExamples(object):
8 9 @expose
10 - def no_call(self):
11 return "Mr E. R. Bradshaw"
12 13 @expose()
14 - def call_empty(self):
15 return "Mrs. B.J. Smegma"
16 17 @expose("call_alias")
18 - def nesbitt(self):
19 return "Mr Nesbitt"
20 21 @expose(["alias1", "alias2"])
22 - def andrews(self):
23 return "Mr Ken Andrews"
24 25 @expose(alias="alias3")
26 - def watson(self):
27 return "Mr. and Mrs. Watson"
28
29 30 -class ToolExamples(object):
31 32 @expose 33 @tools.response_headers(headers=[('Content-Type', 'application/data')])
34 - def blah(self):
35 yield ntob("blah")
36 # This is here to demonstrate that _cp_config = {...} overwrites 37 # the _cp_config attribute added by the Tool decorator. You have 38 # to write _cp_config[k] = v or _cp_config.update(...) instead. 39 blah._cp_config['response.stream'] = True
40