adds version and hides None values for qinfo config

This commit is contained in:
Ilan Steemers
2015-10-07 17:06:50 +02:00
parent d4aa010428
commit 680aac8405

View File

@@ -1,6 +1,7 @@
from optparse import make_option
from django.core.management.base import BaseCommand
from django.utils.translation import ugettext as _
from django_q import VERSION
from django_q.conf import Conf
from django_q.monitor import info
@@ -22,7 +23,10 @@ class Command(BaseCommand):
if options.get('config', False):
hide = ['conf', 'IDLE', 'STOPPING', 'STARTING', 'WORKING', 'SIGNAL_NAMES', 'STOPPED']
settings = [a for a in dir(Conf) if not a.startswith('__') and a not in hide]
self.stdout.write('VERSION: {}'.format('.'.join(str(v) for v in VERSION)))
for setting in settings:
self.stdout.write('{}: {}'.format(setting, getattr(Conf, setting)))
value = getattr(Conf, setting)
if value is not None:
self.stdout.write('{}: {}'.format(setting, value))
else:
info()