Пример #1
0
def isValidName(name):
    """ Validate user name

    :param name: user name, unicode
    """
    normalized = normalizeName(name)
    return (name == normalized) and not wikiutil.isGroupItem(name)
Пример #2
0
    def testNormalizeGroupName(self):
        """ request: normalize itemname: restrict groups to alpha numeric Unicode

        Spaces should normalize after invalid chars removed!
        """
        cases = (
            # current acl chars
            ('Name,:Group', 'NameGroup'),
            # remove than normalize spaces
            ('Name ! @ # $ % ^ & * ( ) + Group', 'Name Group'),
        )
        for test, expected in cases:
            # validate we are testing valid group names
            if wikiutil.isGroupItem(test):
                result = wikiutil.normalize_pagename(test, app.cfg)
                assert result == expected