def _filter_host(field, value, match_level=None):
 if (match_level is None):
  if ('#' in value):
   match_level = 'pool'
  elif ('@' in value):
   match_level = 'backend'
  else:
   match_level = 'host'
 conn_str = CONF.database.connection
 if (conn_str.startswith('mysql') and (conn_str[5] in ['+', ':'])):
  cmp_value = func.binary(value)
  like_op = 'LIKE BINARY'
 else:
  cmp_value = value
  like_op = 'LIKE'
 conditions = [(field == cmp_value)]
 if (match_level != 'pool'):
  conditions.append(field.op(like_op)((value + '#%')))
  if (match_level == 'host'):
   conditions.append(field.op(like_op)((value + '@%')))
 return or_(*conditions)

def _filter_host ( field , value , match_level = None ) : if ( match_level is None ) : if ( '#' in value ) : match_level = 'pool' elif ( '@' in value ) : match_level = 'backend' else : match_level = 'host' conn_str = CONF . database . connection if ( conn_str . startswith ( 'mysql' ) and ( conn_str [ 5 ] in [ '+' , ':' ] ) ) : cmp_value = func . binary ( value ) like_op = 'LIKE BINARY' else : cmp_value = value like_op = 'LIKE' conditions = [ ( field == cmp_value ) ] if ( match_level != 'pool' ) : conditions . append ( field . op ( like_op ) ( ( value + '#%' ) ) ) if ( match_level == 'host' ) : conditions . append ( field . op ( like_op ) ( ( value + '@%' ) ) ) return or_ ( * conditions )
generate a filter condition for host and cluster fields .