Exemple #1
0
def mail_sponsee_message(award, sponsor):
	sponsee = award.winner
	logging.debug("sending e-mail to %s", sponsee.email)
	if not mail.is_email_valid(sponsee.email):
		logging.error("%s is not valid", sponsee.email)
		return False
	message = mail.EmailMessage()
	message.sender = get_sender()
	message.subject = "You've earned a PlopQuiz sponsorship!"
	message.to = sponsee.email
	from model.employer import Employer
	this_business = Employer.get_by_key_name(sponsor.unique_identifier)
	sponsor_message = this_business.sponsorship_message
	if sponsor_message is None:
		sponsor_message = this_business.default_message()
	message.body = """
 
	%s,
	
	You've earned a PlopQuiz sponsorship from %s for the %s quiz subject!
	
	Here is a message from %s: 
	
	-------------------------------------------------------------------
	
	
	
	%s
	
	
	
	-------------------------------------------------------------------
	
	This sponsorship is now on your profile: %s 
	
	This sponsorship is now on the profile of %s: %s
	
	
	%s
	
    
	
	""" % (sponsee.fullname, sponsor.fullname, award.proficiency.name.upper(), sponsor.fullname, sponsor_message, 
	       "http://" + str(os.environ['HTTP_HOST']) + "/profile/" + sponsee.profile_path,
	       sponsor.fullname,
	       "http://" + str(os.environ['HTTP_HOST']) + "/sponsors/" + sponsor.profile_path,
	       mail_footer())

	message.send()
Exemple #2
0
 def add_auto_pledge(self, *args):
 	if not args: return "Specify A Business Identifier, Proficiency Name, and Number of Pledges."
 	if len(args) > 3: return "Specify A Business Identifier, Proficiency Name, and Number of Pledges."
 	business_name = args[0]
 	from model.employer import Employer
 	this_employer = Employer.get_by_key_name(business_name)
 	if not this_employer: return "employer does not exist"
 	proficiency_name = args[1]
 	from model.proficiency import Proficiency
 	#import string -- Capwords sucks, darnit.
 	#this_proficiency = Proficiency.get_by_key_name(string.capwords(proficiency_name))
 	this_proficiency = Proficiency.get_by_key_name(proficiency_name)
 	pledge_num = int(args[2])
 	from model.employer import AutoPledge
 	new_pledge = AutoPledge(employer = this_employer,
 	                        proficiency = this_proficiency,
 	                        count = pledge_num)
 	new_pledge.put()
 	return encode(new_pledge)                       
Exemple #3
0
 def UpdateSponsorName(self, user, name):
     from model.employer import Employer
     this_sponsor = Employer.get_by_key_name(user.unique_identifier)
     this_sponsor.name = name
     return this_sponsor