From: Ralf Jung Date: Mon, 14 Oct 2013 19:56:34 +0000 (+0200) Subject: Put a date in the e-mails X-Git-Url: https://git.ralfj.de/saartuer.git/commitdiff_plain/4bca211aea7e724156b2efd21cca7b56fe92df8c?ds=inline;hp=--cc Put a date in the e-mails --- 4bca211aea7e724156b2efd21cca7b56fe92df8c diff --git a/libtuer.py b/libtuer.py index 8f9c48f..afef36e 100644 --- a/libtuer.py +++ b/libtuer.py @@ -1,6 +1,6 @@ import logging, logging.handlers, os, time, queue, threading, subprocess import traceback, smtplib -from email.mime.text import MIMEText +import email.mime.text, email.util # Logging configuration syslogLevel = logging.INFO @@ -11,8 +11,9 @@ mailAddress = 'post+tuer'+'@'+'ralfj.de' def sendeMail(subject, text, receivers, sender='sphinx@hacksaar.de', replyTo=None): if not isinstance(type(receivers), list): receivers = [receivers] # construct content - msg = MIMEText(text.encode('UTF-8'), 'plain', 'UTF-8') + msg = email.mime.text.MIMEText(text.encode('UTF-8'), 'plain', 'UTF-8') msg['Subject'] = subject + msg['Date'] = email.utils.formatdate(localtime=True) msg['From'] = sender msg['To'] = ', '.join(receivers) if replyTo is not None: diff --git a/statemachine.py b/statemachine.py index 01cf83f..9e50327 100644 --- a/statemachine.py +++ b/statemachine.py @@ -201,7 +201,7 @@ class StateMachine(): if pins.door_locked: return StateMachine.StateZu(self.state_machine) def handle_cmd_unlock_event(self,callback): - callback("409 conflict: The server is currently trying to lock the door. Try again later.") + callback("409 conflict: The sphinx is currently trying to lock the door. Try again later.") def could_not_close(self): logger.critical("StateMachine: Couldn't close door after %d tries. Going back to StateAboutToOpen." % CLOSE_REPEAT_NUMBER) return StateMachine.StateAboutToOpen(self.state_machine)