author | terom |
Tue, 18 Mar 2008 00:04:02 +0000 | |
changeset 32 | cc2d9db311c0 |
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