test: (sms-get.py) don't fail if we don't get an SMSC

This commit is contained in:
Dan Williams
2012-02-02 21:12:17 -06:00
parent 681a24c8d8
commit 76c9b29415

View File

@@ -55,7 +55,13 @@ msgs = sms.List()
i = 0 i = 0
for m in msgs: for m in msgs:
print "-------------------------------------------------------------------" print "-------------------------------------------------------------------"
print "%d: From: %s Time: %s SMSC: %s" % (m["index"], m["number"], m["timestamp"], m["smsc"]) smsc = ""
try:
smsc = m["smsc"]
except KeyError:
pass
print "%d: From: %s Time: %s SMSC: %s" % (m["index"], m["number"], m["timestamp"], smsc)
if len(m["text"]): if len(m["text"]):
print " %s\n" % m["text"] print " %s\n" % m["text"]
elif len(m["data"]): elif len(m["data"]):