title: passing function to a decorator in cherrypy
body: <p>How do I pass the <code>index()</code> to the decorator function called <code>uppercase()</code>. I want the value passed from <code>index()</code> to be capitalized. </p>
  
  <p>I am getting this error:</p>
  
  <pre><code>500 Internal Server Error
  The server encountered an unexpected condition which prevented it from fulfilling the request.
  
  Traceback (most recent call last):
    File "/home/user/.local/lib/python3.6/site-packages/cherrypy/_cprequest.py", line 638, in respond
      self._do_respond(path_info)
    File "/home/user/.local/lib/python3.6/site-packages/cherrypy/_cprequest.py", line 701, in _do_respond
      self.hooks.run('before_finalize')
    File "/home/user/.local/lib/python3.6/site-packages/cherrypy/_cprequest.py", line 95, in run
      self.run_hooks(iter(sorted(self[point])))
    File "/home/user/.local/lib/python3.6/site-packages/cherrypy/_cprequest.py", line 117, in run_hooks
      hook()
    File "/home/user/.local/lib/python3.6/site-packages/cherrypy/_cprequest.py", line 65, in __call__
      return self.callback(**self.kwargs)
  TypeError: uppercase() missing 1 required positional argument: 'func'
  </code></pre>
  
  <hr>
  
  <pre class="lang-py prettyprint-override"><code>import cherrypy
  from cherrypy import tools
  
  @cherrypy.tools.register('before_finalize')
  def uppercase(func):
      def wrapper():
          original_result = func()
          modified_result = original_result.upper()
          return modified_result
      return wrapper
  
  class HelloWorld(object):
      @cherrypy.expose
      @cherrypy.tools.uppercase()
      def index(self):
          return 'Hello!'
  
  
  if __name__ == '__main__':
      cherrypy.tools.uppercase = cherrypy.Tool('before_finalize', uppercase)
      cherrypy.quickstart(HelloWorld())
  </code></pre>