scripts/fix_duplicate_shorturls.py
changeset 139 d3167c40e7b9
parent 138 130fb8a8dbb9
child 140 7ea9766e33ed
--- a/scripts/fix_duplicate_shorturls.py	Wed Jul 01 20:03:41 2009 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-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
-