
from functools import wraps

# General Decorators


def parseRoutePath(f):
    ''' Decorator to parse generic route path '''
    @wraps(f)
    def decorated_function(inst, *args, **kwargs):
        for kw in kwargs['path'].split('/'):
            if len(kw) == 0:
                continue
            var, value = kw.split('=')
            kwargs[var] = value
        kwargs.pop('path')
        return f(inst, *args, **kwargs)
    return decorated_function


from functools import wraps

# General Decorators


def parseRoutePath(f):
    ''' Decorator to parse generic route path '''
    @wraps(f)
    def decorated_function(inst, *args, **kwargs):
        if 'path' in kwargs and kwargs['path']:
            for kw in kwargs['path'].split('/'):
                if len(kw) == 0:
                    continue
                var, value = kw.split('=')
                kwargs[var] = value
        kwargs.pop('path')
        return f(inst, *args, **kwargs)
    return decorated_function

fix for route parser to handle when path=None