Пример #1
0
def deferred_delete_question_and_answers(question_id, service):
    try:
        dbquestion.delete_question(question_id, service)
        dbquestion.delete_answers(question_id, service)
        dbquestion.delete_printed_question(question_id, service)
    except Exception, exception:
        logging.exception("db error deleting question and answers")
Пример #2
0
 def GET(self):
     result = {}
     action = web.input(action = None)['action']
     
     if action=='quota': 
         results = urlfetch.fetch('https://api.stackexchange.com/2.0/info?site=stackoverflow&key=%s' % api_key, headers = {'User-Agent': 'StackPrinter'}, deadline = 10)
         response = simplejson.loads(results.content)
         result['result'] = response
     if action=='quotaauth': 
         results = urlfetch.fetch('https://api.stackexchange.com/2.0/info?site=stackoverflow&key=%s&access_token=%s' % (api_key, TokenManager.get_auth_token()), headers = {'User-Agent': 'StackPrinter'}, deadline = 10)
         response = simplejson.loads(results.content)
         result['result'] = response
     if action=='authkey': 
         result['result'] = TokenManager.get_auth_token()
     elif action =='memcachestats':
         result = memcache.get_stats()        
     elif action =='memcacheflush':
         result['result'] = memcache.flush_all()
     elif action =='normalize':
         deferred.defer(worker.deferred_normalize_printed_question)    
         result['result'] = True
     elif action =='delete':
         service = web.input(service = None)['service']
         question_id = web.input(question_id = None)['question_id']
         result['printed_question_deletion'] = dbquestion.delete_printed_question(question_id,service)
         result['question_deletion'] = dbquestion.delete_question(question_id,service)
         result['answers_deletion'] = dbquestion.delete_answers(question_id,service)
     return render.admin(result)
Пример #3
0
 def GET(self):
     result = {}
     action = web.input(action = None)['action']
     
     if action=='quota': 
         results = urlfetch.fetch('https://api.stackexchange.com/2.0/info?site=stackoverflow&key=%s' % api_key, headers = {'User-Agent': 'StackPrinter'}, deadline = 10)
         response = simplejson.loads(results.content)
         result['result'] = response
     if action=='quotaauth': 
         results = urlfetch.fetch('https://api.stackexchange.com/2.0/info?site=stackoverflow&key=%s&access_token=%s' % (api_key, TokenManager.get_auth_token()), headers = {'User-Agent': 'StackPrinter'}, deadline = 10)
         response = simplejson.loads(results.content)
         result['result'] = response
     if action=='authkey': 
         result['result'] = TokenManager.get_auth_token()
     elif action =='memcachestats':
         result = memcache.get_stats()        
     elif action =='memcacheflush':
         result['result'] = memcache.flush_all()
     elif action =='normalize':
         deferred.defer(worker.deferred_normalize_printed_question)    
         result['result'] = True
     elif action =='delete':
         service = web.input(service = None)['service']
         question_id = web.input(question_id = None)['question_id']
         result['printed_question_deletion'] = dbquestion.delete_printed_question(question_id,service)
         result['question_deletion'] = dbquestion.delete_question(question_id,service)
         result['answers_deletion'] = dbquestion.delete_answers(question_id,service)
     return render.admin(result)