mirror of
https://github.com/JimmXinu/FanFicFare.git
synced 2025-12-22 00:33:59 +01:00
53 lines
No EOL
1.2 KiB
Python
53 lines
No EOL
1.2 KiB
Python
#!/usr/bin/env python
|
|
# encoding: utf-8
|
|
"""
|
|
remover.py
|
|
|
|
Created by Roman on 2010-06-20.
|
|
Copyright (c) 2010 __MyCompanyName__. All rights reserved.
|
|
"""
|
|
|
|
import datetime
|
|
import logging
|
|
|
|
from google.appengine.ext.webapp import util
|
|
from google.appengine.ext import webapp
|
|
from google.appengine.api import users
|
|
|
|
from ffstorage import *
|
|
|
|
class Remover(webapp.RequestHandler):
|
|
def get(self):
|
|
logging.debug("Starting r3m0v3r")
|
|
user = users.get_current_user()
|
|
logging.debug("Working as user %s" % user)
|
|
theDate = datetime.date.today() - datetime.timedelta(days=2)
|
|
logging.debug("Will delete stuff older than %s" % theDate)
|
|
|
|
fics = DownloadedFanfic.all()
|
|
fics.order("date")
|
|
|
|
results = fics.fetch(50)
|
|
|
|
|
|
logging.debug([x.name for x in results])
|
|
|
|
num = 0
|
|
for d in results:
|
|
# d.blob = None
|
|
# d.cleared = True
|
|
d.delete()
|
|
num = num + 1
|
|
logging.info('Deleted instances: %d' % num)
|
|
self.response.out.write('Deleted instances: %d' % num)
|
|
|
|
|
|
def main():
|
|
application = webapp.WSGIApplication([('/r3m0v3r', Remover)],
|
|
debug=False)
|
|
util.run_wsgi_app(application)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
logging.getLogger().setLevel(logging.DEBUG)
|
|
main() |