Revision ead18dbc snf-tools/snf-admin
b/snf-tools/snf-admin | ||
---|---|---|
75 | 75 |
print '%s: %s' % (key.rjust(margin), val) |
76 | 76 |
|
77 | 77 |
def print_item(item): |
78 |
print '%d %s' % (item.id, item.name) |
|
78 |
name = getattr(item, 'name', '') |
|
79 |
print '%d %s' % (item.id, name) |
|
79 | 80 |
print_dict(item.__dict__, exclude=('id', 'name')) |
80 | 81 |
|
81 | 82 |
def print_items(items, detail=False, keys=None): |
... | ... | |
521 | 522 |
print_dict(stats) |
522 | 523 |
|
523 | 524 |
|
525 |
class ListInvitations(Command): |
|
526 |
group = 'invitation' |
|
527 |
name = 'list' |
|
528 |
syntax = '[invitation id]' |
|
529 |
description = 'list invitations' |
|
530 |
|
|
531 |
def main(self, invitation_id=None): |
|
532 |
if invitation_id: |
|
533 |
invitations = [models.Invitations.objects.get(id=invitation_id)] |
|
534 |
else: |
|
535 |
invitations = models.Invitations.objects.order_by('id') |
|
536 |
print_items(invitations, detail=True, keys=('id',)) |
|
537 |
|
|
538 |
|
|
539 |
class ResendInviation(Command): |
|
540 |
group = 'invitation' |
|
541 |
name = 'resend' |
|
542 |
syntax = '<invitation id>' |
|
543 |
description = 'resend an invitation' |
|
544 |
|
|
545 |
def main(self, invitation_id): |
|
546 |
invitation = models.Invitations.objects.get(id=invitation_id) |
|
547 |
send_invitation(invitation) |
|
548 |
|
|
549 |
|
|
524 | 550 |
def print_usage(exe, groups, group=None, shortcut=False): |
525 | 551 |
nop = Command(exe, []) |
526 | 552 |
nop.parser.print_help() |
... | ... | |
534 | 560 |
for command, cls in sorted(commands.items()): |
535 | 561 |
if cls.hidden: |
536 | 562 |
continue |
537 |
name = ' %s %s' % (group, command) |
|
563 |
name = ' %s %s' % (group, command or '')
|
|
538 | 564 |
print '%s %s' % (name.ljust(22), cls.description) |
539 | 565 |
|
540 | 566 |
|
Also available in: Unified diff