def cache_with_field(field_name):
 def decorator(fn):
  @wraps(fn, assigned=available_attrs(fn))
  def wrapper(self, *args, **kwargs):
   force_fresh = kwargs.pop('force_fresh', False)
   field_val = getattr(self, field_name)
   if ((field_val is not None) and (not force_fresh)):
    return field_val
   field_val = fn(self, force_fresh=force_fresh)
   setattr(self, field_name, field_val)
   return field_val
  return wrapper
 return decorator

def cache_with_field ( field_name ) : def decorator ( fn ) : @ wraps ( fn , assigned = available_attrs ( fn ) ) def wrapper ( self , * args , ** kwargs ) : force_fresh = kwargs . pop ( 'force_fresh' , False ) field_val = getattr ( self , field_name ) if ( ( field_val is not None ) and ( not force_fresh ) ) : return field_val field_val = fn ( self , force_fresh = force_fresh ) setattr ( self , field_name , field_val ) return field_val return wrapper return decorator
decorator for generated content methods .