title: Add decorator to a method that is generated dynamically
body: <p>This code creates and adds methods to a class:</p>
  <pre><code>def add_controller(self, cls, i, return_url):
      @http.route(return_url, type=&quot;http&quot;, auth=&quot;public&quot;, website=True)  # Very important, missing!
      def innercontroller(self, **kw):
          print(&quot;Helloo here with ID: &quot; + i)
  
      innercontroller.__name__ = &quot;controller_html_form_id_&quot; + i  # Name of the new method
      setattr(cls, innercontroller.__name__, innercontroller)
      print(&quot;Done&quot;)
  
  def create(self):
      self.add_controller(HtmlFormController, i, return_url)
  </code></pre>
  <p>The code works fine and the method is generated, but unfortunately without the decorator.
  I want to create multiple methods with different <code>return_url</code>, meaning that every decorator will be different.</p>
  <p>EDIT:</p>
  <p>In the end, I want to have a method like this:</p>
  <pre><code>@http.route(&quot;/custom13&quot;, type=&quot;http&quot;, auth=&quot;public&quot;, website=True)
  def controller_html_form_id_13(slef, **kw):
      return &quot;Example method!&quot;
  </code></pre>
  <p>So then when the user calls the route <code>example.com/custom13</code>, then he should see <code>Example method!</code> in his browser.</p>
  <p>The only thing missing is the <strong>decorator <code>@http.route(...)</code></strong></p>
  <p>How can I add this decorator to the generated method?</p>