예제 #1
0
파일: members.py 프로젝트: jine/internal
def make_civic_regno(db, is_female, is_samordningsnummer):
    regno = make_civic_regno_naive(is_female, is_samordningsnummer)
    while not common.ensure_unique_value(db, 'members', 'civicregno', regno):
        print "Civic registration number collision: randomized number already in database: %s. Randomizing again, no worries." % (
            regno)
        regno = make_civic_regno_naive(is_female, is_samordningsnummer)
    return regno
예제 #2
0
def make_unique_rfid(db, length):
    rfid = common.get_random_digit_string(length).zfill(16)
    while not common.ensure_unique_value(db, 'member_rfid', 'tagid', rfid):
        print "RFID collision: randomized tagid already in database: %s. Randomizing again, no worries." % (
            rfid)
        rfid = common.get_random_digit_string(length).zfill(16)
    return rfid
예제 #3
0
def make_unique_rfid(db, length):
    rfid = common.get_random_digit_string(length).zfill(16)
    while not common.ensure_unique_value(db, 'member_rfid', 'tagid', rfid):
        print "RFID collision: randomized tagid already in database: %s. Randomizing again, no worries." % (rfid)
        rfid = common.get_random_digit_string(length).zfill(16)
    return rfid
예제 #4
0
def make_civic_regno(db, is_female, is_samordningsnummer):
    regno = make_civic_regno_naive(is_female, is_samordningsnummer)
    while not common.ensure_unique_value(db, 'members', 'civicregno', regno):
        print "Civic registration number collision: randomized number already in database: %s. Randomizing again, no worries." % (regno)
        regno = make_civic_regno_naive(is_female, is_samordningsnummer)
    return regno