Put a date in the e-mails
authorRalf Jung <post@ralfj.de>
Mon, 14 Oct 2013 19:56:34 +0000 (21:56 +0200)
committerRalf Jung <post@ralfj.de>
Mon, 14 Oct 2013 19:56:34 +0000 (21:56 +0200)
libtuer.py
statemachine.py

index 8f9c48f7a0b0ee6d828f1de220569a1c24abe96e..afef36e9b261981fb8359af2e0b3de85c6600f89 100644 (file)
@@ -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:
index 01cf83f33b2d600bb383024a276c89c2d1e3f904..9e5032747c31fbc40ffe3176b234d18829a0868d 100644 (file)
@@ -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)