Ejemplo n.º 1
0
Archivo: rpc.py Proyecto: jamslevy/PQ
 def refresh_mailing_list(self, *args):
   from model.account import MailingList
   entries = MailingList.all().fetch(1000)
   for e in entries: e.delete()
   from methods import DataMethods
   data = DataMethods()
   data.load_data("mailing_list", "")
   return self.dump_mailing_list()
Ejemplo n.º 2
0
Archivo: mail.py Proyecto: jamslevy/PQ
	def get_next_recipient(self):
		mail_queue = memcache.get(self.mail_type)
		if mail_queue is None: # doesn't exist yet
		    logging.info('creating mail queue')
		    mail_queue = MailingList.gql("WHERE type = :1", self.mail_type).fetch(1000)
		    memcache.set(self.mail_type, mail_queue) 
		if len(mail_queue) < 1: 
		    memcache.delete(self.mail_type)
		    print "Mailout Is Finished"
		    return False, False
		return mail_queue, mail_queue.pop()
Ejemplo n.º 3
0
from google.appengine.ext import db
from .model.quiz import QuizItem, RawQuizItem, ProficiencyTopic, ContentPage, Proficiency
from .utils.utils import ROOT_PATH
from utils import simplejson
from employer.methods import DataMethods as emp_data
from google.appengine.api import images
from .model.user import ProfilePicture	
from .model.proficiency import SubjectImage, Link
from model.employer import Employer
from model.account import MailingList
from google.appengine.api import memcache
from model.dev import Setting

DATA_TYPES = {"proficiencies": Proficiency.all(), 'proficiency_topics': ProficiencyTopic.all(), 'links': Link.all(), 'content_pages': ContentPage.all(), 'raw_items' : RawQuizItem.all(),
               'quiz_items': QuizItem.all(), 
               'mailing_list': MailingList.all(), 'employers': Employer.all(), 'settings': Setting.all()}

LOAD_INCREMENT = 10 # How many entities are loaded into datastore at a time
IMAGE_INCREMENT = 1 # How many entities are loaded into datastore at a time

#Refresh One Data Type
def refresh_data(data_type):
    data = DataMethods()
    data.delete_data(DATA_TYPES.get(data_type, False))
    data.load_data(data_type, "")
    data.special_processes(data_type)
    data.execute_load()


def delete_data(data_type):
    data = DataMethods()