title: How to decorate a method inside a class?
body: <p>I am attempting to decorate a method inside a class but python is throwing an error. My class looks like this:</p>
  
  <pre><code>from pageutils import formatHeader
  
  class myPage(object):
     def __init__(self):
        self.PageName = ''
  
     def createPage(self):
        pageHeader = self.createHeader()
  
     @formatHeader   #&lt;----- decorator
     def createHeader(self):
         return "Page Header ",self.PageName
  
  if __name__=="__main__":
     page = myPage()
     page.PageName = 'My Page'
     page.createPage()
  </code></pre>
  
  <hr>
  
  <p><code>pageutils.py</code>:</p>
  
  <pre><code>def formatHeader(fn):
     def wrapped():
         return '&lt;div class="page_header"&gt;'+fn()+'&lt;/div&gt;'
     return wrapped
  </code></pre>
  
  <p>Python throws the following error</p>
  
  <pre class="lang-none prettyprint-override"><code>self.createHeader()
  TypeError: wrapped() takes no arguments (1 given)
  </code></pre>
  
  <p>Where am I goofing?</p>