def version_handler(min_ver, max_ver=None):
 def decorator(f):
  min_version_float = float(min_ver)
  if max_ver:
   max_version_float = float(max_ver)
  else:
   max_version_float = float(max_version_string())
  qualified_name = _fully_qualified_name(f)
  VERSIONED_METHODS[qualified_name].append((min_version_float, max_version_float, f))
  def decorated_func(req, *args, **kwargs):
   version_float = float(req.environ[MICROVERSION_ENVIRON])
   return _find_method(f, version_float)(req, *args, **kwargs)
  VERSIONED_METHODS[qualified_name].sort(key=(lambda x: x[0]), reverse=True)
  return decorated_func
 return decorator

def version_handler ( min_ver , max_ver = None ) : def decorator ( f ) : min_version_float = float ( min_ver ) if max_ver : max_version_float = float ( max_ver ) else : max_version_float = float ( max_version_string ( ) ) qualified_name = _fully_qualified_name ( f ) VERSIONED_METHODS [ qualified_name ] . append ( ( min_version_float , max_version_float , f ) ) def decorated_func ( req , * args , ** kwargs ) : version_float = float ( req . environ [ MICROVERSION_ENVIRON ] ) return _find_method ( f , version_float ) ( req , * args , ** kwargs ) VERSIONED_METHODS [ qualified_name ] . sort ( key = ( lambda x : x [ 0 ] ) , reverse = True ) return decorated_func return decorator
decorator for versioning api methods .