projects
/
saartuer.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
3313462
)
Put a date in the e-mails
author
Ralf Jung
<post@ralfj.de>
Mon, 14 Oct 2013 19:56:34 +0000
(21:56 +0200)
committer
Ralf Jung
<post@ralfj.de>
Mon, 14 Oct 2013 19:56:34 +0000
(21:56 +0200)
libtuer.py
patch
|
blob
|
history
statemachine.py
patch
|
blob
|
history
diff --git
a/libtuer.py
b/libtuer.py
index 8f9c48f7a0b0ee6d828f1de220569a1c24abe96e..afef36e9b261981fb8359af2e0b3de85c6600f89 100644
(file)
--- a/
libtuer.py
+++ b/
libtuer.py
@@
-1,6
+1,6
@@
import logging, logging.handlers, os, time, queue, threading, subprocess
import traceback, smtplib
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
# 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
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['Subject'] = subject
+ msg['Date'] = email.utils.formatdate(localtime=True)
msg['From'] = sender
msg['To'] = ', '.join(receivers)
if replyTo is not None:
msg['From'] = sender
msg['To'] = ', '.join(receivers)
if replyTo is not None:
diff --git
a/statemachine.py
b/statemachine.py
index 01cf83f33b2d600bb383024a276c89c2d1e3f904..9e5032747c31fbc40ffe3176b234d18829a0868d 100644
(file)
--- 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):
if pins.door_locked:
return StateMachine.StateZu(self.state_machine)
def handle_cmd_unlock_event(self,callback):
- callback("409 conflict: The s
erver
is currently trying to lock the door. Try again later.")
+ callback("409 conflict: The s
phinx
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)
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)