NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

_test_decorators.py (845B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\carbon\common\lib\cherrypy\test\_test_decorators.py
      2 from cherrypy import expose, tools
      3 from cherrypy._cpcompat import ntob
      4 
      5 class ExposeExamples(object):
      6 
      7     @expose
      8     def no_call(self):
      9         return 'Mr E. R. Bradshaw'
     10 
     11     @expose()
     12     def call_empty(self):
     13         return 'Mrs. B.J. Smegma'
     14 
     15     @expose('call_alias')
     16     def nesbitt(self):
     17         return 'Mr Nesbitt'
     18 
     19     @expose(['alias1', 'alias2'])
     20     def andrews(self):
     21         return 'Mr Ken Andrews'
     22 
     23     @expose(alias='alias3')
     24     def watson(self):
     25         return 'Mr. and Mrs. Watson'
     26 
     27 
     28 class ToolExamples(object):
     29 
     30     @expose
     31     @tools.response_headers(headers=[('Content-Type', 'application/data')])
     32     def blah(self):
     33         yield ntob('blah')
     34 
     35     blah._cp_config['response.stream'] = True