From: Ralf Jung Date: Wed, 23 Oct 2013 16:51:40 +0000 (+0200) Subject: Merge branch 'master' of ralfj.de:saartuer X-Git-Url: https://git.ralfj.de/saartuer.git/commitdiff_plain/f5e51ba317a3119d1c2ea987cb922a8f437122dd?hp=b0d0a5fc4029d3aa82aa76006e48c00720d25b13 Merge branch 'master' of ralfj.de:saartuer --- diff --git a/libtuer.py b/libtuer.py index 097a25a..1789b90 100644 --- a/libtuer.py +++ b/libtuer.py @@ -10,7 +10,8 @@ printLevel = logging.DEBUG # Mail logging handler def sendeMail(subject, text, receivers, sender='sphinx@hacksaar.de', replyTo=None): - if not isinstance(type(receivers), list): receivers = [receivers] + assert isinstance(receivers, list) + if not len(receivers): return # nothing to do # construct content msg = email.mime.text.MIMEText(text.encode('UTF-8'), 'plain', 'UTF-8') msg['Subject'] = subject diff --git a/tuerd b/tuerd index 5c91f92..1bee788 100755 --- a/tuerd +++ b/tuerd @@ -3,7 +3,16 @@ import RPi.GPIO as GPIO import statemachine, actor, pins, tysock, waker from libtuer import logger import argparse -# TODO: implement some arguments, e.g. --debug which does not send e-mails and prints debug stuff + +# Parse arguments +parser = argparse.ArgumentParser(description='Run a door') +parser.add_argument("-d", "--debug", + action="store_true", dest="debug", + help="Don't send emails") +args = parser.parse_args() +if args.debug: + import libtuer + libtuer.mailAddress = [] # initialize GPIO stuff GPIO.setmode(GPIO.BOARD)