

def _validate_security_group_property(self, value, typ):
    " typ will be either 'name' or 'description',\n            depending on the caller\n        "
    try:
        val = value.strip()
    except AttributeError:
        msg = (_('Security group %s is not a string or unicode') % typ)
        raise exc.HTTPBadRequest(explanation=msg)
    if (not val):
        msg = (_('Security group %s cannot be empty.') % typ)
        raise exc.HTTPBadRequest(explanation=msg)
    if (len(val) > 255):
        msg = (_('Security group %s should not be greater than 255 characters.') % typ)
        raise exc.HTTPBadRequest(explanation=msg)

dataset/ETHPy150Open nii-cloud/dodai-compute/nova/api/openstack/contrib/security_groups.py SecurityGroupController._validate_security_group_property/original