"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "ec2api/api/validator.py" between
ec2-api-14.0.1.tar.gz and ec2-api-15.0.0.tar.gz

About: OpenStack EC2 API provides a standalone EC2 (and VPC) API service.
The "Zed" series (latest release).

validator.py  (ec2-api-14.0.1):validator.py  (ec2-api-15.0.0)
skipping to change at line 19 skipping to change at line 19
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import re import re
import netaddr import netaddr
from oslo_log import log as logging from oslo_log import log as logging
import six
from ec2api import exception from ec2api import exception
from ec2api.i18n import _ from ec2api.i18n import _
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
def validate_str(val, parameter_name, max_length=None): def validate_str(val, parameter_name, max_length=None):
if (isinstance(val, six.string_types) and if (isinstance(val, str) and
(max_length is None or max_length and len(val) <= max_length)): (max_length is None or max_length and len(val) <= max_length)):
return True return True
raise exception.ValidationError( raise exception.ValidationError(
reason=_("%s should not be greater " reason=_("%s should not be greater "
"than 255 characters.") % parameter_name) "than 255 characters.") % parameter_name)
def validate_bool(val, parameter_name): def validate_bool(val, parameter_name):
if isinstance(val, bool): if isinstance(val, bool):
return True return True
raise exception.ValidationError( raise exception.ValidationError(
 End of changes. 2 change blocks. 
2 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)