getting rid of Py2.6 DeprecationWarnings

This commit is contained in:
Ken Conley 2010-09-20 18:21:37 +00:00
parent 8f36a9299a
commit 8fb9113225
2 changed files with 4 additions and 4 deletions

View File

@ -148,8 +148,8 @@ def apivalidate(error_return_value, validators=()):
try:
newArgs.append(v(a, caller_id))
except ParameterInvalid, e:
_logger.error("%s: invalid parameter: %s", f.func_name, e.message or 'error')
return -1, e.message or 'error', error_return_value
_logger.error("%s: invalid parameter: %s", f.func_name, str(e) or 'error')
return -1, str(e) or 'error', error_return_value
else:
newArgs.append(a)

View File

@ -41,10 +41,10 @@ ROSRPC = "rosrpc://"
class ParameterInvalid(Exception):
"""Exception that is raised when a parameter fails validation checks"""
def __init__(self, message):
self.message = message
self._message = message
def __str__(self):
return str(self.message)
return str(self._message)
def non_empty(param_name):
"""Validator that checks that parameter is not empty"""