]> git.openstreetmap.org Git - osqa.git/blobdiff - forum_modules/sximporter/importer.py
fixes OSQA-562, Mixed-up markdown mangling of simple comment text
[osqa.git] / forum_modules / sximporter / importer.py
index ec17de7e0461e916e06d929aaa259ac9cb63565d..44f90d78cdaf73a37539f6f186a161d3fdf9bbf7 100644 (file)
@@ -170,6 +170,7 @@ def userimport(path, options):
 #users = readTable(dump, "Users")
 
     usernames = []
+    openids = set()
     uidmapper = IdMapper()
     #merged_users = []
 
@@ -186,6 +187,8 @@ def userimport(path, options):
         #print "\n".join(["%s : %s" % i for i in sxu.items()])
         if int(sxu.get('id')) == int(owneruid):
             osqau = orm.User.objects.get(id=1)
+            for assoc in orm.AuthKeyUserAssociation.objects.filter(user=osqau):
+                openids.add(assoc.key)
             uidmapper[owneruid] = 1
             uidmapper[-1] = 1
             create = False
@@ -290,9 +293,16 @@ def userimport(path, options):
         usernames.append(osqau.username)
 
         openid = sxu.get('openid', None)
-        if openid and openidre.match(openid):
+        if openid and openidre.match(openid) and (not openid in openids):
             assoc = orm.AuthKeyUserAssociation(user=osqau, key=openid, provider="openidurl")
             assoc.save()
+            openids.add(openid)
+
+        openidalt = sxu.get('openidalt', None)
+        if openidalt and openidre.match(openidalt) and (not openidalt in openids):
+            assoc = orm.AuthKeyUserAssociation(user=osqau, key=openidalt, provider="openidurl")
+            assoc.save()
+            openids.add(openidalt)
 
     readTable(path, "Users", callback)
 
@@ -989,4 +999,4 @@ SELECT setval('"forum_openidassociation_id_seq"', coalesce(max("id"), 1) + 2, ma
 
 
     
-    
\ No newline at end of file
+