Commit bfdb454b authored by Baptiste Jonglez's avatar Baptiste Jonglez
Browse files

Fix verbosity being a string and not an int

parent 41e51c75
......@@ -12,6 +12,7 @@ class Command(BaseCommand):
help = 'Create invoices for members subscriptions for date specified (or today if no date passed)'
def handle(self, *args, **options):
verbosity = int(options['verbosity'])
try:
date = datetime.datetime.strptime(args[0], '%Y-%m-%d').date()
except IndexError:
......@@ -20,13 +21,13 @@ class Command(BaseCommand):
raise CommandError(
'Please enter a valid date : YYYY-mm-dd (ex: 2011-07-04)')
if options['verbosity'] >= 2:
if verbosity >= 2:
self.stdout.write(
'Create invoices for all members for the date : %s' % date)
with respect_language(settings.LANGUAGE_CODE):
invoices = create_all_members_invoices_for_a_period(date)
if invoices > 0 or options['verbosity'] >= 2:
if invoices > 0 or verbosity >= 2:
self.stdout.write(
u'%d invoices were created' % len(invoices))
......@@ -21,6 +21,7 @@ class Command(BaseCommand):
can be passed as argument."""
def handle(self, *args, **options):
verbosity = int(options['verbosity'])
try:
date = datetime.datetime.strptime(args[0], '%Y-%m-%d').date()
except IndexError:
......@@ -35,7 +36,7 @@ class Command(BaseCommand):
date,
date + relativedelta(months=+1)]
if options['verbosity'] >= 2:
if verbosity >= 2:
self.stdout.write("Selecting members whose membership fee end at "
"the following dates : {dates}".format(
dates=[str(d) for d in end_dates]))
......@@ -43,7 +44,7 @@ class Command(BaseCommand):
members = Member.objects.filter(status='member')\
.annotate(end=Max('membership_fees__end_date'))\
.filter(end__in=end_dates)
if options['verbosity'] >= 2:
if verbosity >= 2:
self.stdout.write(
"Got {number} members.".format(number=members.count()))
......@@ -56,6 +57,6 @@ class Command(BaseCommand):
member=member, email=member.email))
cpt = cpt + 1
if cpt > 0 or options['verbosity'] >= 2:
if cpt > 0 or verbosity >= 2:
self.stdout.write("{number} call for membership fees emails were "
"sent".format(number=cpt))
Supports Markdown
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