Commit 6eadbe43 authored by Kelvin Rodriguez's avatar Kelvin Rodriguez
Browse files

updated decorated to be more generic

parent 114e9c39
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -399,7 +399,7 @@ def decorate_class(cls, decorator, exclude=[], *args, **kwargs):
    # return decorated copy (i.e. a subclass with decorations)
    return decorate(type('cls_copy', cls.__bases__, dict(cls.__dict__)))

def create_decorator(*args, **kwargs):
def create_decorator(dec, **namespace):
    """
    Create a decorator function using arbirary params. The objects passed in
    can be used in the body. Originally designed with the idea of automatically
@@ -408,7 +408,7 @@ def create_decorator(*args, **kwargs):
    def decorator(func):
        def wrapper(self, *args, **kwargs):
            ret = func(self, *args, **kwargs)
            # do something with obj
            exec(dec, *args, **kwargs)
            if ret:
                return ret
        return wrapper