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
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
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
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
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