Esempio n. 1
0
	def get(self):
		subscriptions = AlertSubscription.query()
		calhandler = StkCal()
		cal = calhandler.getCal('','')
		for subscription in subscriptions:
			alertText = ''
			alertList = []
			for alert in json.loads(subscription.alerts):
				if alert['active'] is True:
					if alert['name'] == calhandler.isSpecialDay(datetime.now() + timedelta(days=3)):
						alertList.append(alert.name)
			if len(alertList) > 0:
				for todayAlert in alertList:
					alertText += todayAlert + '\n'
				sender = "Tom Schneider <*****@*****.**>"
				subject = "Alert"
				body = """Hello,
This is an automatically delivered email to remind you of the following:

%s

It is strongly recommanded that you take care of it ASAP.

Regards.

THAS""" % alertText
				mail.send_mail(sender, subscription.email, subject, body)
				logging.warning(body)
Esempio n. 2
0
	def get(self):
		month = self.request.get('month')
		year = self.request.get('year')

		calhandler = StkCal()
		cal = json.loads(calhandler.getCal(month, year))
		#self.response.out.write(cal)

		values = {
			'title': 'STK Calendar',
			'calendar': cal,
		}

		template = JINJA_ENVIRONMENT.get_template('templates/stkcal.html')
                self.response.write(template.render(values))