Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
b72fc759
Commit
b72fc759
authored
Jun 08, 2012
by
Kostas Papadimitriou
Browse files
Display service token in listservices command
parent
31bf50a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
snf-astakos-app/astakos/im/management/commands/listservices.py
View file @
b72fc759
...
...
@@ -39,7 +39,7 @@ from astakos.im.models import Service
class
Command
(
BaseCommand
):
help
=
"List g"
option_list
=
BaseCommand
.
option_list
+
(
make_option
(
'-c'
,
action
=
'store_true'
,
...
...
@@ -47,28 +47,30 @@ class Command(BaseCommand):
default
=
False
,
help
=
"Use pipes to separate values"
),
)
def
handle
(
self
,
*
args
,
**
options
):
if
args
:
raise
CommandError
(
"Command doesn't accept any arguments"
)
services
=
Service
.
objects
.
all
()
labels
=
(
'id'
,
'name'
,
'url'
,
'icon'
)
columns
=
(
3
,
12
,
40
,
4
0
)
labels
=
(
'id'
,
'name'
,
'url'
,
'auth_token'
,
'icon'
)
columns
=
(
3
,
12
,
40
,
20
,
2
0
)
if
not
options
[
'csv'
]:
line
=
' '
.
join
(
l
.
rjust
(
w
)
for
l
,
w
in
zip
(
labels
,
columns
))
self
.
stdout
.
write
(
line
+
'
\n
'
)
sep
=
'-'
*
len
(
line
)
self
.
stdout
.
write
(
sep
+
'
\n
'
)
for
service
in
services
:
fields
=
(
str
(
service
.
id
),
service
.
name
,
service
.
url
,
service
.
icon
)
fields
=
(
str
(
service
.
id
),
service
.
name
,
service
.
url
,
service
.
auth_token
,
service
.
icon
)
if
options
[
'csv'
]:
line
=
'|'
.
join
(
fields
)
else
:
line
=
' '
.
join
(
f
.
rjust
(
w
)
for
f
,
w
in
zip
(
fields
,
columns
))
self
.
stdout
.
write
(
line
.
encode
(
'utf8'
)
+
'
\n
'
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment