Revision 5ce3ce4f snf-astakos-app/astakos/im/management/commands/user_show.py

b/snf-astakos-app/astakos/im/management/commands/user_show.py
41 41
class Command(BaseCommand):
42 42
    args = "<user ID or email>"
43 43
    help = "Show user info"
44
    
44

  
45 45
    def handle(self, *args, **options):
46 46
        if len(args) != 1:
47 47
            raise CommandError("Please provide a user ID or email")
48
        
48

  
49 49
        email_or_id = args[0]
50 50
        if email_or_id.isdigit():
51 51
            users = AstakosUser.objects.filter(id=int(email_or_id))
......
55 55
            field = 'id' if email_or_id.isdigit() else 'email'
56 56
            msg = "Unknown user with %s '%s'" % (field, email_or_id)
57 57
            raise CommandError(msg)
58
        
58

  
59 59
        for user in users:
60 60
            kv = {
61 61
                'id': user.id,
......
81 81
                'email_verified': format_bool(user.email_verified),
82 82
                'username': user.username,
83 83
                'activation_sent_date': format_date(user.activation_sent),
84
                'resources' : user.quota
84
                'resources': user.quota
85 85
            }
86 86
            if get_latest_terms():
87 87
                has_signed_terms = user.signed_terms
88 88
                kv['has_signed_terms'] = format_bool(has_signed_terms)
89 89
                if has_signed_terms:
90
                    kv['date_signed_terms'] = format_date(user.date_signed_terms)
91
            
90
                    kv['date_signed_terms'] = format_date(
91
                        user.date_signed_terms)
92

  
92 93
            for key, val in sorted(kv.items()):
93 94
                line = '%s: %s\n' % (key.rjust(22), val)
94 95
                self.stdout.write(line.encode('utf8'))
95
            self.stdout.write('\n')
96
            self.stdout.write('\n')

Also available in: Unified diff