def __set_name(self, name): # 检查名称的合法性 # slashes make for invalid names # 此处的container名称既可以是str,也可以是unicode,可能会引起一些误会 # 不如统一起来 if isinstance(name, (str, unicode)) and \ ('/' in name or len(name) > consts.container_name_limit): raise InvalidContainerName(name) self._name = name
def _check_container_name(self, container_name): if not container_name or \ '/' in container_name or \ len(container_name) > consts.container_name_limit: raise InvalidContainerName(container_name)
def __set_name(self, name): # slashes make for invalid names if isinstance(name, (str, unicode)) and \ ('/' in name or len(name) > consts.container_name_limit): raise InvalidContainerName(name) self._name = name