title: Bottle for Python : How to use the bottle as an attribute
body: <p>I want to design an API using Bottle for Python 3.6, but I don't see how to bind route to function with a bottle attribute as <code>@self.bottle.route...</code> decorators are not allowed.
  What I have is : </p>
  
  <pre class="lang-py prettyprint-override"><code>from bottle import Bottle, request
  class API_v1:
      def __init__(self, repository):
          self.bottle = Bottle()
          self.repository = repository
  
          @self.bottle.error(400)
          def error400(error):
              return error.body
  
          @self.bottle.error(500)
          def error500(error):
              return f'Technical exception : {error.body}'
  
          @self.bottle.put('/job')
          def job():
              #do stuff with repository
              return ''
  </code></pre>
  
  <p>(notice all functions are initialized inside <code>__init__</code>, it's quite bad)</p>
  
  <p>What I want is something like :</p>
  
  <pre class="lang-py prettyprint-override"><code>from bottle import Bottle, request
  class API_v1:
      def __init__(self, repository):
          self.bottle = Bottle()
          self.repository = repository
  
      @self.bottle.error(400)
      def error400(self, error):
          return error.body
  
      @self.bottle.error(500)
      def error500(self, error):
          return f'Technical exception : {error.body}'
  
      @self.bottle.put('/job')
      def job(self):
          #do stuff with repository
          return ''
  </code></pre>
  
  <p>What is the best pythonic way to handle this?</p>