Here's the gist of what I'm trying to do. I have a list of objects, and I know they have an instance method that looks like:
def render(self, name, value, attrs)
# Renders a widget...
I want to (essentialy) decorate these functions at runtime, as I'm iterating over the list of objects. So that their render functions become this:
def render(self, name, value, attrs)
self.attrs=attrs
# Renders a widget...
Two caveats: 1. The render function is part of django. I can't put a decorator inside their library (well I could, but then I have to maintain and migrate this change). 2. It's an instance method.
An example here: http://wiki.python.org/moin/PythonDecoratorLibrary
Shows how to add a new instance method to a class. The difference here is I want to fall through to the original method after I've memorized that attrs parameter.