Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(2)  |  Derive(0)  |  Import(0)
Validation function.  Returns true iff s contains a valid
server nickname -- that is, a string of 1..128 characters,
containing only the characters [A-Za-z0-9], or '-'.  It must
not begin with a digit or a '-'.

        def _parseNickname(s):
    """Validation function.  Returns true iff s contains a valid
       server nickname -- that is, a string of 1..128 characters,
       containing only the characters [A-Za-z0-9], or '-'.  It must
       not begin with a digit or a '-'.
       """
    s = s.strip()
    bad = s.translate(mixminion.Common._ALLCHARS, _NICKNAME_CHARS)
    if len(bad):
        raise ConfigError("Invalid characters %r in nickname %r" % (bad,s))
    if len(s) > MAX_NICKNAME:
        raise ConfigError("Nickname is too long")
    elif len(s) == 0:
        raise ConfigError("Nickname is too short")
    elif s[0] not in _NICKNAME_INITIAL_CHARS:
        raise ConfigError("Nickname begins with invalid character %r" %s[0])
    return s
        


src/m/i/mixminion-HEAD/lib/mixminion/directory/Directory.py   mixminion(Download)
                commented, vote, nickname, fingerprint = m.groups()
                try:
                    mixminion.Config._parseNickname(nickname)
                except mixminion.Config.ConfigError, e:
                    if not commented:

src/m/i/mixminion-HEAD/lib/mixminion/test.py   mixminion(Download)
        self.assertEquals(time.gmtime(tm)[:6], (2001,12,25,6,15,10))
        # nicknames
        self.assertEquals(C._parseNickname("Mrs-Premise"), "Mrs-Premise")
        # Filenames
        self.assertEquals(C._parseFilename(" ab/c/d"), "ab/c/d")