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
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
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
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