.web/utils/__init__.py
def num_or_string(v, d=None):
  """Loads a value from MO into either an int or string value.
  String is returned if we can't turn it into an int.
  """
  try:
    return int(str(v))#.replace(',', '')
  except (ValueError, TypeError):
    try:
      _value = float(str(v).replace(',', '.'))
      if _value == 0:
        return 0
      return _value
    except (ValueError, TypeError):
      pass
  return d or v
Loads a value from MO into either an int or string value.
  String is returned if we can't turn it into an int.
  
Loads a value from MO into either an int or string value.
String is returned if we can't turn it into an int.
Loads a value from MO into either an int or string value . String is returned if we can ' t turn it into an int .
def num_or_string(v, d=None):
  try:
    return int(str(v))
  except (ValueError, TypeError):
    try:
      _value = float(str(v).replace(',', '.'))
      if _value == 0:
        return 0
      return _value
    except (ValueError, TypeError):
      pass
  return d or v
def num_or_string ( v , d = None ) : try : return int ( str ( v ) ) except ( ValueError , TypeError ) : try : _value = float ( str ( v ) . replace ( ',' , '.' ) ) if _value == 0 : return 0 return _value except ( ValueError , TypeError ) : pass return d or v
Loads a value from MO into either an int or string value.
Loads a value from MO into either an int or string value .
"""Loads a value from MO into either an int or string value.
  String is returned if we can't turn it into an int.
  """ #.replace(',', '')
v
d