Revision cc92b70f snf-cyclades-app/synnefo/plankton/management/commands/image-list.py
b/snf-cyclades-app/synnefo/plankton/management/commands/image-list.py | ||
---|---|---|
38 | 38 |
class Command(BaseCommand): |
39 | 39 |
help = "List public images or images available to a user." |
40 | 40 |
option_list = BaseCommand.option_list + ( |
41 |
make_option('--user-id', dest='userid', |
|
42 |
help="List all images available to that user."\ |
|
43 |
" If no user is specified, only public images"\ |
|
41 |
make_option( |
|
42 |
'--user-id', |
|
43 |
dest='userid', |
|
44 |
help="List all images available to that user." |
|
45 |
" If no user is specified, only public images" |
|
44 | 46 |
" are displayed."), |
45 |
)
|
|
47 |
) |
|
46 | 48 |
|
47 | 49 |
def handle(self, **options): |
48 | 50 |
userid = options['userid'] |
... | ... | |
54 | 56 |
headers = ("id", "name", "owner", "public") |
55 | 57 |
table = [] |
56 | 58 |
for img in images: |
57 |
fields = (img["id"], img["name"], img["owner"], str(img["is_public"])) |
|
59 |
fields = (img["id"], img["name"], img["owner"], |
|
60 |
str(img["is_public"])) |
|
58 | 61 |
table.append(fields) |
59 | 62 |
pprint_table(self.stdout, table, headers) |
Also available in: Unified diff