← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1465659] Re: Use utils.validate_integer for int validation

 

** Changed in: nova
       Status: Fix Committed => Fix Released

** Changed in: nova
    Milestone: None => liberty-2

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1465659

Title:
  Use utils.validate_integer for int validation

Status in OpenStack Compute (nova):
  Fix Released

Bug description:
  Instead of checking for int type and min value separately,
  utils.validate_integer method can be used.

  for eg.:

      try:
          rotation = int(rotation)
      except ValueError:
          msg = _("createBackup attribute 'rotation' must be an integer")
          raise exc.HTTPBadRequest(explanation=msg)
      if rotation < 0:
          msg = _("createBackup attribute 'rotation' must be greater "
                  "than or equal to zero")
          raise exc.HTTPBadRequest(explanation=msg)

  can be replaced with

      try:
          rotation = utils.validate_integer(rotation, "rotation", min_value=0)
      except exception.InvalidInput as e:
          raise webob.exc.HTTPBadRequest(explanation=e.format_message())

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1465659/+subscriptions


References