Revision 3b99d2d6 snf-astakos-app/astakos/im/management/commands/user-add.py

b/snf-astakos-app/astakos/im/management/commands/user-add.py
42 42
from django.core.exceptions import ValidationError
43 43

  
44 44
from astakos.im.models import AstakosUser
45
from astakos.im.api.callpoint import AstakosDjangoDBCallpoint
45
from astakos.im.api.callpoint import AstakosCallpoint
46 46

  
47 47
from ._common import add_user_permission
48 48

  
......
111 111
            u['password'] = AstakosUser.objects.make_random_password()
112 112

  
113 113
        try:
114
            c = AstakosDjangoDBCallpoint()
115
            c.create_users((u,))
114
            c = AstakosCallpoint()
115
            r = c.create_users((u,))
116 116
        except socket.error, e:
117 117
            raise CommandError(e)
118 118
        except ValidationError, e:
119
            raise CommandError(e)
119
            raise CommandError(e)
120
        else:
121
            failed = (res for res in r if not res.is_success)
122
            for r in failed:
123
                if not r.is_success:
124
                    raise CommandError(r.reason)
125
            if not failed:
126
                self.stdout.write('User created successfully')
127
                if not u.get('password'):
128
                    self.stdout.write('with password: %s' % u['password'])

Also available in: Unified diff