def uses_settings(handle, path, lazy_load=True):
 config = get_config(handle)
 if ((not lazy_load) and (not config.get('settings_loaded', False))):
  config.load(path)
  config.set('settings_loaded', 'true')
 def decorator(func):
  def wrapped(*args, **kwargs):
   if (lazy_load and (not config.get('settings_loaded', False))):
    config.load(path)
    config.set('settings_loaded', 'true')
   if ('config' in inspect.getargspec(func).args):
    return func(config=config, *args, **kwargs)
   else:
    return func(*args, **kwargs)
  return wrapped
 return decorator

def uses_settings ( handle , path , lazy_load = True ) : config = get_config ( handle ) if ( ( not lazy_load ) and ( not config . get ( 'settings_loaded' , False ) ) ) : config . load ( path ) config . set ( 'settings_loaded' , 'true' ) def decorator ( func ) : def wrapped ( * args , ** kwargs ) : if ( lazy_load and ( not config . get ( 'settings_loaded' , False ) ) ) : config . load ( path ) config . set ( 'settings_loaded' , 'true' ) if ( 'config' in inspect . getargspec ( func ) . args ) : return func ( config = config , * args , ** kwargs ) else : return func ( * args , ** kwargs ) return wrapped return decorator
provides a function that can be used as a decorator for other functions that require settings to be loaded .