Is that possible to make this kind of decorator in python (2.4)?
<p>I have class Window. This class has method onClick which gets argument the id of control clicked on that window (i can not change the way it's work):</p>

<pre><code> class Window(SoneBaseWindowClass):

    def onClick(self,controlID):
        print controlID
</code></pre>

<p>I want to make decorator which will add my method to callback stack. 
And than method onClick will call certain method when certain control get clicked.
So:</p>

<pre><code>class Window(SoneBaseWindowClass):
    def __init__(self):
        callback_stack = {}

    def onClick(self,controlId):
        callback = self.callback_stack.get(controlID)
        if callback is not None:
            callback()

    # suppose to add decorated method to a callback_stack
    def onclick_decorator(method):
        pass
</code></pre>

<p>So I need to make decorator which will add some method to <code>callback_stack</code>. Example using.</p>

<pre><code>class MyWindow(Window):

    @onclick_decorator(12345)
    def someMethod(self):
        print "Gets called when control with id 12345 clicked"
</code></pre>

<p>Actually the question is how can i get acces to class from <code>onclick_decorator</code>
Self is not passed to that method. So i can assume that it could get acces to class, but could not figure out how.</p>
