示例#1
0
def edit_user(username, formalName=None, bio=None, pic=None, stripeID=None):
    """
    edit an existing user by their username, return the user object
    """
    user = get_user_by_username(username)
    if user:
        if formalName: user.formalName = formalName
        if bio: user.bio = bio
        if pic: user.pic = pic
        if stripeID: user.stripeID = stripeID
        user.put()
        return user
    else:
        return False
示例#2
0
def edit_user(username, formalName=None, bio=None, pic=None, stripeID=None):
    """
    edit an existing user by their username, return the user object
    """
    user = get_user_by_username(username)
    if user:
        if formalName: user.formalName = formalName
        if bio: user.bio = bio
        if pic: user.pic = pic
        if stripeID: user.stripeID = stripeID
        user.put()
        return user
    else:
        return False
示例#3
0
def validate_username(username, localUser = None):
    '''
    verify that the given username is unique or raise a NameError exception
    '''
    if username in ProtectedNames:
        raise NameError("That username is protected, choose a different one")

    if re.match("^[a-zA-Z0-9]*$", username) is None:
        raise NameError("Your username may only contain numbers and letters")

    if len(username)<5 or len(username)>20:
        raise NameError("Your username must be at least 5 characters and no more than 20")

    if get_user_by_username(username) is not None:
        raise NameError("That username is already taken")
示例#4
0
def validate_username(username, localUser=None):
    '''
    verify that the given username is unique or raise a NameError exception
    '''
    if username in ProtectedNames:
        raise NameError("That username is protected, choose a different one")

    if re.match("^[a-zA-Z0-9]*$", username) is None:
        raise NameError("Your username may only contain numbers and letters")

    if len(username) < 5 or len(username) > 20:
        raise NameError(
            "Your username must be at least 5 characters and no more than 20")

    if get_user_by_username(username) is not None:
        raise NameError("That username is already taken")