from MaKaC.user import AvatarHolder

ah = AvatarHolder()
#migrate dict to list
for av in ah.getValuesToList():
    if not isinstance(av.identities, list):
        av.identities = av.identities.values()

from MaKaC.authentication.NiceAuthentication import NiceAuthenticator, NiceIdentity
na = NiceAuthenticator()
from MaKaC.authentication.LocalAuthentication import LocalAuthenticator
la = LocalAuthenticator()


#sync authenticators identities to avatars identity list
for id in la.getValuesToList():
    u = id.getUser()
    if not id in u.getIdentityList():
        try:
            u.addIdentity(id)
        except:
            print u.getId()

for id in na.getValuesToList():
    u = id.getUser()
    if not id in u.getIdentityList():
        try:
            u.addIdentity(id)
        except:
            print u.getId()
from MaKaC.user import AvatarHolder

ah = AvatarHolder()
#migrate dict to list
for av in ah.getValuesToList():
    if not isinstance(av.identities, list):
        av.identities = av.identities.values()

from MaKaC.authentication.NiceAuthentication import NiceAuthenticator, NiceIdentity
na = NiceAuthenticator()
from MaKaC.authentication.LocalAuthentication import LocalAuthenticator
la = LocalAuthenticator()

#sync authenticators identities to avatars identity list
for id in la.getValuesToList():
    u = id.getUser()
    if not id in u.getIdentityList():
        try:
            u.addIdentity(id)
        except:
            print u.getId()

for id in na.getValuesToList():
    u = id.getUser()
    if not id in u.getIdentityList():
        try:
            u.addIdentity(id)
        except:
            print u.getId()