Exemplo n.º 1
0
 def run(self):
     deployments = Deployment.objects
     option = prompt_choices('Deployment', [
         (str(i), v) for i, v in enumerate(deployments, 1)])
     deployment = deployments[int(option) - 1]
     for u in users.find(deployment=deployment):
         print 'User(id=%s email=%s)' % (u.id, u.email)
Exemplo n.º 2
0
def can_create_user(email, password, password_confirm, deployment):
    data = MultiDict(dict(email=email, password=password,
                     password_confirm=password_confirm))
    form = RegisterForm(data, csrf_enabled=False)

    if form.validate():
        return True, {}

    email_errors = form.errors.get('email', [])
    if (len(email_errors) == 1) and \
        (email_errors[0] ==
            get_message('EMAIL_ALREADY_ASSOCIATED', email=email)[0]):
        accounts = users.find(email=email, deployment=deployment)
        if not accounts:
            return True, {}

    return False, form.errors