示例#1
0
 def nameIsValid(self, name):
     self.notify.debug('nameIsValid')
     if name in self.usedNames:
         return Localizer.ToonAlreadyExists % name
     problem = NameCheck.checkName(name)
     if problem:
         return problem
     return None
     return
示例#2
0
    def nameIsValid(self, name):
        self.notify.debug("nameIsValid")
        if name in self.usedNames:
            return Localizer.ToonAlreadyExists % name

        problem = NameCheck.checkName(name)
        if problem:
            return problem

        return None
示例#3
0
def checkNames(names, goodFlags=None):
    if goodFlags:
        pass
    for i in range(len(names)):
        name = names[i]
        problem = NameCheck.checkName(name.strip())
        if problem:
            print '   user msg: ' + problem
        if goodFlags:
            if problem:
                pass
示例#4
0
def checkNames(names, goodFlags = None):
    if goodFlags:
        pass
    1
    for i in range(len(names)):
        name = names[i]
        problem = NameCheck.checkName(name.strip())
        if problem:
            print '   user msg: ' + problem
        
        if goodFlags:
            if problem:
                pass
            1
示例#5
0
def checkNames(names, goodFlags=None):
    if goodFlags:
        # make sure they're the same length
        assert len(names) == len(goodFlags)
    for i in range(len(names)):
        name = names[i]
        # the game does the strip() in NameShop.py
        problem = NameCheck.checkName(name.strip())
        if problem:
            print('   user msg: ' + problem)
        if goodFlags:
            # make sure our results are consistent
            if problem:
                assert not goodFlags[i], "good name was rejected: '%s'" % name
            else:
                assert goodFlags[i], "bad name was accepted: '%s'" % name