def validate_quotes(value):
 open_quotes = True
 for i in range(len(value)):
  if (value[i] == '"'):
   if (i and (value[(i - 1)] == '\\')):
    continue
   if open_quotes:
    if (i and (value[(i - 1)] != ',')):
     msg = (_('Invalid filter value %s. There is no comma before opening quotation mark.') % value)
     raise exception.InvalidParameterValue(message=msg)
   elif (((i + 1) != len(value)) and (value[(i + 1)] != ',')):
    msg = (_('Invalid filter value %s. There is no comma after closing quotation mark.') % value)
    raise exception.InvalidParameterValue(message=msg)
   open_quotes = (not open_quotes)
 if (not open_quotes):
  msg = (_('Invalid filter value %s. The quote is not closed.') % value)
  raise exception.InvalidParameterValue(message=msg)

def validate_quotes ( value ) : open_quotes = True for i in range ( len ( value ) ) : if ( value [ i ] == '"' ) : if ( i and ( value [ ( i - 1 ) ] == '\\' ) ) : continue if open_quotes : if ( i and ( value [ ( i - 1 ) ] != ',' ) ) : msg = ( _ ( 'Invalid filter value %s. There is no comma before opening quotation mark.' ) % value ) raise exception . InvalidParameterValue ( message = msg ) elif ( ( ( i + 1 ) != len ( value ) ) and ( value [ ( i + 1 ) ] != ',' ) ) : msg = ( _ ( 'Invalid filter value %s. There is no comma after closing quotation mark.' ) % value ) raise exception . InvalidParameterValue ( message = msg ) open_quotes = ( not open_quotes ) if ( not open_quotes ) : msg = ( _ ( 'Invalid filter value %s. The quote is not closed.' ) % value ) raise exception . InvalidParameterValue ( message = msg )
validate filter values validation opening/closing quotes in the expression .