fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
New layout pages.
[wolnelektury.git]
/
src
/
funding
/
management
/
commands
/
funding_notify.py
diff --git
a/src/funding/management/commands/funding_notify.py
b/src/funding/management/commands/funding_notify.py
old mode 100755
(executable)
new mode 100644
(file)
index
342c963
..
792c171
--- a/
src/funding/management/commands/funding_notify.py
+++ b/
src/funding/management/commands/funding_notify.py
@@
-1,17
+1,17
@@
-# -*- coding: utf-8 -*-
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
-from optparse import make_option
from django.core.management.base import BaseCommand
class Command(BaseCommand):
from django.core.management.base import BaseCommand
class Command(BaseCommand):
- option_list = BaseCommand.option_list + (
- make_option('-q', '--quiet', action='store_false', dest='verbose', default=True, help='Suppress output'),
- )
help = 'Sends relevant funding notifications.'
help = 'Sends relevant funding notifications.'
+ def add_arguments(self, parser):
+ parser.add_argument(
+ '-q', '--quiet', action='store_false', dest='verbose',
+ default=True, help='Suppress output')
+
def handle(self, **options):
from datetime import date, timedelta
def handle(self, **options):
from datetime import date, timedelta
@@
-24,10
+24,10
@@
class Command(BaseCommand):
for offer in Offer.past().filter(notified_end=None):
if verbose:
for offer in Offer.past().filter(notified_end=None):
if verbose:
- print
'Notify end:', offer
+ print
('Notify end:', offer)
# The 'WL fund' list needs to be updated.
caches[settings.CACHE_MIDDLEWARE_ALIAS].clear()
# The 'WL fund' list needs to be updated.
caches[settings.CACHE_MIDDLEWARE_ALIAS].clear()
- offer.
flush_includes
()
+ offer.
clear_cache
()
offer.notify_end()
current = Offer.current()
offer.notify_end()
current = Offer.current()
@@
-35,5
+35,5
@@
class Command(BaseCommand):
current.end <= date.today() + timedelta(app_settings.DAYS_NEAR - 1) and
not current.notified_near):
if verbose:
current.end <= date.today() + timedelta(app_settings.DAYS_NEAR - 1) and
not current.notified_near):
if verbose:
- print
'Notify near:', current
+ print
('Notify near:', current)
current.notify_near()
current.notify_near()