def autoload(Model, extract_key, inject_key, func):
 @functools.wraps(func)
 def wrapper(*args, **kwargs):
  primary_key = kwargs.get(extract_key)
  instance = get_or_http_error(Model, primary_key)
  kwargs[inject_key] = instance
  return func(*args, **kwargs)
 return wrapper

def autoload ( Model , extract_key , inject_key , func ) : @ functools . wraps ( func ) def wrapper ( * args , ** kwargs ) : primary_key = kwargs . get ( extract_key ) instance = get_or_http_error ( Model , primary_key ) kwargs [ inject_key ] = instance return func ( * args , ** kwargs ) return wrapper
find assets by looking for an assets module within each installed application .