author | terom |
Sun, 04 May 2008 18:23:03 +0000 | |
changeset 33 | 4943047bfcb5 |
parent 22 | 72696ca68c34 |
permissions | -rw-r--r-- |
from lib import shorturl db = shorturl.DB(read_only=False) ids = dict() newid = db.db['_id'] for key in db.db.keys() : if key.startswith('_') : continue if len(key) == 1 : print "key %s is too short!?" % key del db.db[key] continue print "%s:" % key, id = shorturl.key2int(key) if id in ids : newkey = shorturl.int2key(newid) newid += 1 print "%d -> %s, -> %s" % (id, ids[id], newkey) db.db[newkey] = db.db[key] del db.db[key] else : print "ok" ids[id] = key