Commit 0af0fd57 authored by Sofia Papagiannaki's avatar Sofia Papagiannaki Committed by Georgios D. Tsoukalas

Unify astakos management command formatting

parent c1923a42
......@@ -35,7 +35,7 @@ from django.core.management.base import BaseCommand, CommandError
from astakos.im.models import Invitation
from ._common import format_bool, format_date
from ._common import format
class Command(BaseCommand):
......@@ -56,13 +56,13 @@ class Command(BaseCommand):
'real name': invitation.realname,
'email': invitation.username,
'code': invitation.code,
'consumed': format_bool(invitation.is_consumed),
'date created': format_date(invitation.created),
'date consumed': format_date(invitation.consumed),
'consumed': invitation.is_consumed,
'date created': invitation.created,
'date consumed': invitation.consumed,
'inviter real name': invitation.inviter.realname,
'invitater email': invitation.inviter.email,
}
for key, val in sorted(kv.items()):
line = '%s: %s\n' % (key.rjust(18), val)
line = '%s: %s\n' % (key.rjust(18), format(val))
self.stdout.write(line)
......@@ -67,9 +67,9 @@ class Command(NoArgsCommand):
id = str(invitation.id)
code = str(invitation.code)
consumed = format_bool(invitation.is_consumed)
fields = (
id, invitation.inviter.email, invitation.username, invitation.realname,
code, consumed)
fields = (format(elem) for elem in \
(id, invitation.inviter.email, invitation.username,
invitation.realname, code, consumed))
if options['csv']:
line = '|'.join(fields)
......
......@@ -36,7 +36,7 @@ from optparse import make_option
from django.core.management.base import NoArgsCommand
from astakos.im.models import Chain
from ._common import format_bool, shortened
from ._common import format, shortened
class Command(NoArgsCommand):
......@@ -71,13 +71,13 @@ class Command(NoArgsCommand):
for info in chain_info(chain_dict):
fields = [
fields = [(format(elem) for elem in (
(info['projectid'], False),
(info['name'], True),
(info['owner'], True),
(info['status'], False),
(info['appid'], False),
]
)]
if options['csv']:
line = '|'.join(fields)
......
......@@ -37,7 +37,7 @@ from django.core.management.base import BaseCommand, CommandError
from synnefo.lib.ordereddict import OrderedDict
from astakos.im.models import Chain, ProjectApplication
from ._common import format_bool, format_date
from ._common import format
class Command(BaseCommand):
......@@ -86,7 +86,7 @@ class Command(BaseCommand):
def show_info(self, info):
for key, val in info.items():
line = '%s: %s\n' % (key.rjust(22), val)
line = '%s: %s\n' % (key.rjust(22), format(val))
self.stdout.write(line)
self.stdout.write('\n')
......@@ -140,9 +140,9 @@ def app_fields(app):
('homepage', app.homepage),
('description', app.description),
('comments for review', app.comments),
('request issue date', format_date(app.issue_date)),
('request start date', format_date(app.start_date)),
('request end date', format_date(app.end_date)),
('request issue date', app.issue_date),
('request start date', app.start_date),
('request end date', app.end_date),
('resources', app.resource_policies),
('join policy', app.member_join_policy_display),
('leave policy', app.member_leave_policy_display),
......@@ -168,15 +168,15 @@ def project_fields(s, project, last_app):
('homepage', app.homepage),
('description', app.description),
('comments for review', app.comments),
('request issue date', format_date(app.issue_date)),
('request start date', format_date(app.start_date)),
('creation date', format_date(project.creation_date)),
('request end date', format_date(app.end_date)),
('request issue date', app.issue_date),
('request start date', app.start_date),
('creation date', project.creation_date),
('request end date', app.end_date),
])
deact_date = project.deactivation_date
if deact_date is not None:
d['deactivation date'] = format_date(deact_date)
d['deactivation date'] = deact_date
mem_limit = app.limit_on_members_number
mem_limit_show = mem_limit if mem_limit is not None else "unlimited"
......
......@@ -37,7 +37,7 @@ from django.core.management.base import NoArgsCommand
from astakos.im.models import AstakosUser
from ._common import format_bool
from ._common import format
class Command(NoArgsCommand):
......@@ -79,13 +79,16 @@ class Command(NoArgsCommand):
for user in users:
id = str(user.id)
active = format_bool(user.is_active)
admin = format_bool(user.is_superuser)
active = user.is_active
admin = user.is_superuser
uuid = user.uuid or ''
fields = (
id, user.email, user.realname, active, admin, \
uuid, user.auth_providers_display
)
fields = (format(elem) for elem in (
id,
user.email,
user.realname,
active, admin, uuid,
user.auth_providers_display
))
if options['csv']:
line = '|'.join(fields)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment