def parse_data(function):
 def wrapper(*args, **kwargs):
  dicts = kwargs.get('dicts', True)
  expanded = kwargs.get('expanded', True)
  output = function(*args, **kwargs)
  if (dicts and output):
   try:
    if expanded:
     output = map(unparse_model_data, output.dicts())
    else:
     output = [item for item in output.dicts()]
   except (TypeError, OperationalError):
    logging.warn('No content database file found')
    output = []
  return output
 return wrapper

def parse_data ( function ) : def wrapper ( * args , ** kwargs ) : dicts = kwargs . get ( 'dicts' , True ) expanded = kwargs . get ( 'expanded' , True ) output = function ( * args , ** kwargs ) if ( dicts and output ) : try : if expanded : output = map ( unparse_model_data , output . dicts ( ) ) else : output = [ item for item in output . dicts ( ) ] except ( TypeError , OperationalError ) : logging . warn ( 'No content database file found' ) output = [ ] return output return wrapper
parses the output of functions to be dicts .