Explain why a chumhandle is invalid

This commit is contained in:
Kiooeht 2011-08-23 03:23:59 -07:00
parent 17b8b70b66
commit 65fd1d0b29
5 changed files with 11 additions and 9 deletions

View file

@ -27,6 +27,7 @@ CHANGELOG
* Chum notes - Kiooeht [evacipatedBox]
* Customizable name alerts - Kiooeht [evacipatedBox]
* Update bug reporter - Kiooeht [evacipatedBox]
* Explain why a chumhandle is invalid - Kiooeht [evacipatedBox] (Idea: Lexi [lexicalNuance])
* Bug fixes
* Don't delete random chum when blocking someone not on chumroll - Kiooeht [evacipatedBox]
* Openning global userlist doesn't reset OP status of memo users - Kiooeht [evacipatedBox]

View file

@ -15,7 +15,6 @@ Features
* Whowas for last seen online?
* Tab completion of two letter names
* When 'banned' make impossible to connect using timestamp banned under
* Explain why a chumhandle is invalid
* Fully working Toasts
* Auto download/install updates via Windows installer

View file

@ -295,11 +295,13 @@ class PesterProfile(object):
@staticmethod
def checkValid(handle):
caps = [l for l in handle if l.isupper()]
if len(caps) != 1 or handle[0].isupper():
return False
if len(caps) != 1:
return (False, "Must have exactly 1 uppercase letter")
if handle[0].isupper():
return (False, "Cannot start with uppercase letter")
if re.search("[^A-Za-z0-9]", handle) is not None:
return False
return True
return (False, "Only alphanumeric characters allowed")
return (True,)
class PesterHistory(object):
def __init__(self):

View file

@ -862,8 +862,8 @@ class PesterChooseProfile(QtGui.QDialog):
if not PesterProfile.checkLength(handle):
self.errorMsg.setText("PROFILE HANDLE IS TOO LONG")
return
if not PesterProfile.checkValid(handle):
self.errorMsg.setText("NOT A VALID CHUMTAG")
if not PesterProfile.checkValid(handle)[0]:
self.errorMsg.setText("NOT A VALID CHUMTAG. REASON:\n%s" % (PesterProfile.checkValid(handle)[1]))
return
self.accept()

View file

@ -1437,7 +1437,7 @@ class TrollSlumWindow(QtGui.QFrame):
if ok:
handle = unicode(handle)
if not (PesterProfile.checkLength(handle) and
PesterProfile.checkValid(handle)):
PesterProfile.checkValid(handle)[0]):
errormsg = QtGui.QErrorMessage(self)
errormsg.showMessage("THIS IS NOT A VALID CHUMTAG!")
self.addchumdialog = None
@ -2399,7 +2399,7 @@ class PesterWindow(MovingWindow):
if ok:
handle = unicode(handle)
if not (PesterProfile.checkLength(handle) and
PesterProfile.checkValid(handle)):
PesterProfile.checkValid(handle)[0]):
errormsg = QtGui.QErrorMessage(self)
errormsg.showMessage("THIS IS NOT A VALID CHUMTAG!")
self.addchumdialog = None