Example #1
0
 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
Example #2
0
 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)
Example #3
0
 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