def _send_email(self): data = self._get_data() data["not_full_time_users"] = self._get_not_full_time_employees() data["quarters"] = "Q%s" % idate.quarter_number(self.start), "Q%s" % idate.quarter_number(self.end) data["months"] = self.months response = render("intranet3:templates/_email_reports/missed_hours.html", data, request=self.request) response = response.replace("\n", "").replace("\t", "") deferred = EmailSender.send_html(config["MANAGER_EMAIL"], self._(u"[Intranet2] Missed hours"), response) def on_success(result): LOG(u"Report with missed hours - sent") def on_error(err): EXCEPTION(u"Failed to sent report with missed hours") deferred.addCallbacks(on_success, on_error) return data
def _send_email(self): data = self._get_data() data['not_full_time_users'] = self._get_not_full_time_employees() data['quarters'] = 'Q%s' % idate.quarter_number( self.start), 'Q%s' % idate.quarter_number(self.end) data['months'] = self.months response = render( 'intranet3:templates/_email_reports/missed_hours.html', data, request=self.request) response = response.replace('\n', '').replace('\t', '') with mail.EmailSender as email_sender: email_sender.send( config['MANAGER_EMAIL'], self._(u'[Intranet2] Missed hours'), html_message=response, ) return data
def _send_email(self): data = self._get_data() data['not_full_time_users'] = self._get_not_full_time_employees() data['quarters'] = 'Q%s' % idate.quarter_number(self.start), 'Q%s' % idate.quarter_number(self.end) data['months'] = self.months response = render( 'intranet3:templates/_email_reports/missed_hours.html', data, request=self.request ) response = response.replace('\n', '').replace('\t', '') with mail.EmailSender as email_sender: email_sender.send( config['MANAGER_EMAIL'], self._(u'[Intranet2] Missed hours'), html_message=response, ) return data
def _send_email(self): data = self._get_data() data['not_full_time_users'] = self._get_not_full_time_employees() data['quarters'] = 'Q%s' % idate.quarter_number(self.start), 'Q%s' % idate.quarter_number(self.end) data['months'] = self.months response = render( 'intranet3:templates/_email_reports/missed_hours.html', data, request=self.request ) response = response.replace('\n', '').replace('\t', '') deferred = EmailSender.send_html( config['MANAGER_EMAIL'], self._(u'[Intranet2] Missed hours'), response ) def on_success(result): LOG(u'Report with missed hours - sent') def on_error(err): EXCEPTION(u'Failed to sent report with missed hours') deferred.addCallbacks(on_success, on_error) return data
def test_quarter(self): months = [datetime.date(2013, x, 1) for x in range(1, 13)] quarters = [idate.quarter_number(date) for date in months] self.assertEqual(quarters, [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4])