Revision fc28d013

b/snf-astakos-app/astakos/im/functions.py
45 45

  
46 46
logger = logging.getLogger(__name__)
47 47

  
48
def activate(user, email_template_name='welcome_email.txt'):
48
def activate(user, email_template_name='im/welcome_email.txt'):
49 49
    """
50 50
    Activates the specific user and sends email.
51 51
    
......
56 56
    subject = _('Welcome to %s' % SITENAME)
57 57
    message = render_to_string(email_template_name, {
58 58
                'user': user,
59
                'url': urljoin(BASEURL, reverse('astakos.im.views')),
59
                'url': urljoin(BASEURL, reverse('astakos.im.views.index')),
60 60
                'baseurl': BASEURL,
61 61
                'site_name': SITENAME,
62 62
                'support': DEFAULT_CONTACT_EMAIL})
b/snf-astakos-app/astakos/im/management/commands/activateuser.py
57 57
                self.stderr.write(msg)
58 58
                continue
59 59
            
60
            activate(user)
60
            try:
61
                activate(user)
62
                transaction.commit()
63
            except Exception, e:
64
                transaction.rollback()
65
                raise e
61 66
            
62
            self.stdout.write("Activated '%s'\n" % (user.email,))
67
            self.stdout.write("Activated '%s'\n" % (user.email,))
b/snf-astakos-app/astakos/im/management/commands/inviteuser.py
50 50
        if len(args) != 3:
51 51
            raise CommandError("Invalid number of arguments")
52 52
        
53
        user = get_user(args[0])
54
        if not user:
53
        inviter = get_user(args[0])
54
        if not inviter:
55 55
            raise CommandError("Unknown inviter")
56 56
        
57 57
        if inviter.invitations > 0:
b/snf-astakos-app/astakos/im/management/commands/modifyuser.py
66 66
            dest='noadmin',
67 67
            default=False,
68 68
            help="Revoke user's admin rights"),
69
        make_option('--inactive',
70
            action='store_true',
71
            dest='inactive',
72
            default=False,
73
            help="Change user's state to inactive"),
69 74
        )
70 75
    
71 76
    def handle(self, *args, **options):
......
92 97
        if options['renew_token']:
93 98
            user.renew_token()
94 99
        
95
        user.save()
100
        if options.get('inactive'):
101
            user.is_active = False
102
        user.save()

Also available in: Unified diff