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

All Samples(4)  |  Call(2)  |  Derive(0)  |  Import(2)
This normalizes the activation code.
1. lower letters are capitaliezed
2. Oh's in the last two characters are turned to zeros
3. zeros in in the first-2 characters are turned to Ohs

        def normalize_activation_code(activationcode, upper=True, convert_o=True, convert_0=True):
    '''
    This normalizes the activation code.
    1. lower letters are capitaliezed
    2. Oh's in the last two characters are turned to zeros
    3. zeros in in the first-2 characters are turned to Ohs
    '''
    if upper:
        activationcode = activationcode.upper()
    if convert_o:
        activationcode = activationcode[:-2] + activationcode[-2:].replace("O", "0")
    if convert_0:
        activationcode = activationcode[:-2].replace("0", "O") + activationcode[-2:]

    return activationcode
        


src/l/i/LinOTP-2.6.1.1/linotp/lib/tokenclass.py   LinOTP(Download)
### TODO: move this as ocra specific methods
from linotp.lib.token import getRolloutToken4User
from linotp.lib.util import normalize_activation_code
 
from linotp.lib.ocra    import OcraSuite
                raise Exception('no token found for user: %r or serial: %r' % (user, serial))
            helper_param['serial'] = serial
            helper_param['activationcode'] = normalize_activation_code(activationcode)
 
        if ocrasuite is None:

src/l/i/LinOTP-2.6.1.1/linotp/lib/tokens/ocra2token.py   LinOTP(Download)
### TODO: move this as ocra specific methods
from linotp.lib.token import getRolloutToken4User
from linotp.lib.util import normalize_activation_code
 
from linotp.lib.ocra    import OcraSuite
                raise Exception('no token found for user: %r or serial: %r' % (user, serial))
            helper_param['serial'] = serial
            helper_param['activationcode'] = normalize_activation_code(activationcode)
 
        if ocrasuite is None: