forked from code4romania/redirectioneaza
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcron.py
35 lines (21 loc) · 747 Bytes
/
cron.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from webapp2 import Route as r
from google.appengine.ext import ndb
from models.handlers import Handler
from models.models import NgoEntity
from logging import info
class NgoRemoveForms(Handler):
def get(self):
# get all the ngos
ngos = NgoEntity.query().fetch()
info('Removing form_url from {0} ngos.'.format(len(ngos)))
#
to_save = []
# loop through them and remove the form_url
# this will force an update on it when downloaded again
for ngo in ngos:
ngo.form_url = None
to_save.append(ngo)
ndb.put_multi(to_save)
cron_routes = [
r('/ngos/remove-form', handler=NgoRemoveForms, name="ngo-remove-form"),
]