def possibleErrors(self, data):
if self.parent is None:
raise ValueError('cannot call this method without valid parent object')
if isinstance(data, str):
data=[data]
if isinstance(data, collections.Iterable):
del self.errorRefs[:]
for name in data:
found=False
for error in self.parent.applicationErrors:
if error.name == name:
self.errorRefs.append(error.ref)
found=True
break
if found==False:
raise ValueError('invalid error name: "%s"'%name)
else:
raise ValueError("input argument must be string or iterrable")
评论列表
文章目录