예제 #1
0
    class Root:
        def index(self):
            yield "Hello, world"
        index.exposed = True
        h = [("Content-Language", "en-GB"), ('Content-Type', 'text/plain')]
        tools.response_headers(headers=h)(index)

        def other(self):
            return "salut"
        other.exposed = True
        other._cp_config = {
            'tools.response_headers.on': True,
            'tools.response_headers.headers': [("Content-Language", "fr"),
                                               ('Content-Type', 'text/plain')],
            'tools.log_hooks.on': True,
            }
예제 #2
0
    class Root:

        def index(self):
            yield 'Hello, world'

        index.exposed = True
        h = [('Content-Language', 'en-GB'), ('Content-Type', 'text/plain')]
        tools.response_headers(headers=h)(index)

        def other(self):
            return 'salut'

        other.exposed = True
        other._cp_config = {'tools.response_headers.on': True,
         'tools.response_headers.headers': [('Content-Language', 'fr'), ('Content-Type', 'text/plain')],
         'tools.log_hooks.on': True}
예제 #3
0
    class Root:
        @cherrypy.expose
        def index(self):
            yield 'Hello, world'

        h = [('Content-Language', 'en-GB'), ('Content-Type', 'text/plain')]
        tools.response_headers(headers=h)(index)

        @cherrypy.expose
        @cherrypy.config(
            **{
                'tools.response_headers.on':
                True,
                'tools.response_headers.headers': [
                    ('Content-Language', 'fr'),
                    ('Content-Type', 'text/plain'),
                ],
                'tools.log_hooks.on':
                True,
            })
        def other(self):
            return 'salut'