Q:

How to skip or ignore python decorators

There's a function that is wrapped by a decorator that returns the output of the function as HTML.  I'd like to call that function without the HTML-wrapping of the decorator.  Is that even possible? 
Example:
class a:
    @HTMLwrapper
    def returnStuff(input):
        return awesome_dict

    def callStuff():
        # here I want to call returnStuff without the @HTMLwrapper, 
        # i just want the awesome dict. 

A:

class a:
    @HTMLwrapper
    def return_stuff_as_html(self, input):
        return self.return_stuff(input)
    def return_stuff(self, input):
        return awesome_dict

I did the same thing while waiting for a response and it works fine for me, but I'd still like to know if there's an even better way :) – olofom

Since in python functions and methods are objects, and since a decorator returns a callable, you could set an attribute on the decorated method pointing to original method, but a call like my_object_instance.decorated_method.original_method() would be uglier and less explicit. 
>>> import this
The Zen of Python, by Tim Peters

Beautiful is better than ugly. 
Explicit is better than implicit. 
Simple is better than complex. 
Complex is better than complicated. 
Flat is better than nested. 
Sparse is better than dense. 
Readability counts. 
Special cases aren't special enough to break the rules. 
Although practicality beats purity. 
Errors should never pass silently. 
Unless explicitly silenced. 
In the face of ambiguity, refuse the temptation to guess. 
There should be one-- and preferably only one --obvious way to do it. 
Although that way may not be obvious at first unless you're Dutch. 
Now is better than never. 
Although never is often better than *right* now. 
If the implementation is hard to explain, it's a bad idea. 
If the implementation is easy to explain, it may be a good idea. 
Namespaces are one honking great idea -- let's do more of those! 

A:

__author__ = 'Jakob'

class OptionalDecoratorDecorator(object):
    def __init__(self, decorator):
        self.deco = decorator

    def __call__(self, func):
        self.deco = self.deco(func)
        self.func = func
        def wrapped(*args, **kwargs):
            if kwargs.get("no_deco") is True:
                return self.func()
            else:
                return self.deco()
        return wrapped

def spammer(func):
    def wrapped():
        print "spam"
        return func()
    return wrapped

@OptionalDecoratorDecorator(spammer)
def test():
    print "foo"

test()
print "***"
test(no_deco=True)

