def check_int(self):
if isinstance(self.data, int):
return True
if type(self.data) is long:
self.data = int(self.data)
return True
if type(self.data) is Decimal:
self.data = int(self.data)
return True
if isinstance(self.data, (str, unicode)):
import re
if re.match(r"\d+", self.data):
self.data = int(self.data)
return True
if self.data is None:
return True
self.error = self._MESSAGES[self.INT].format(data_type=type(self.data).__name__)
return False
评论列表
文章目录