Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Ignore empty RFIDs

  • Loading branch information...
commit 8b9f2213611ed720cce94f97c787544e606471f5 1 parent 7f45c84
@dustball dustball authored
Showing with 21 additions and 20 deletions.
  1. +21 −20 main.py
View
41 main.py
@@ -78,15 +78,16 @@ def get(self):
self.response.out.write("Access denied")
else:
rfid_tag = self.request.get('rfid_tag')
- m = Membership.all().filter('rfid_tag ==', rfid_tag).get()
- if m:
- username = m.username
- if "active" in m.status:
- success = True
- else:
- success = False
- subject = "Reactivate your RFID key now - renew your Hacker Dojo Subscription!"
- body = """
+ if rfid_tag:
+ m = Membership.all().filter('rfid_tag ==', rfid_tag).get()
+ if m:
+ username = m.username
+ if "active" in m.status:
+ success = True
+ else:
+ success = False
+ subject = "Reactivate your RFID key now - renew your Hacker Dojo Subscription!"
+ body = """
Hi %s,
It looks like you just tried using your RFID key to open the doors to Hacker Dojo.
@@ -98,17 +99,17 @@ def get(self):
With warmest regards,
The Lobby Door
""" % (m.first_name,m.subscribe_url())
- deferred.defer(mail.send_mail, sender="Maglock <brian.klug@hackerdojo.com>", to=m.email,
- subject=subject, body=body, _queue="emailthrottle")
- else:
- username = "unknown ("+rfid_tag+")"
- success = False
- rs = RFIDSwipe(username=username, rfid_tag=rfid_tag, success=success)
- rs.put()
- if "mark.hutsell" in email or "some.other.evilguy" in email:
- deferred.defer(mail.send_mail, sender="Maglock <brian.klug@hackerdojo.com>", to="Emergency Paging System <page@hackerdojo.com>",
- subject="RFID Entry: " + m.username, body="Lobby entry", _queue="emailthrottle")
- urlfetch.fetch("http://www.dustball.com/call/call.php?str=RFID+Entry+"+username)
+ deferred.defer(mail.send_mail, sender="Maglock <brian.klug@hackerdojo.com>", to=m.email,
+ subject=subject, body=body, _queue="emailthrottle")
+ else:
+ username = "unknown ("+rfid_tag+")"
+ success = False
+ rs = RFIDSwipe(username=username, rfid_tag=rfid_tag, success=success)
+ rs.put()
+ if "mark.hutsell" in email or "some.other.evilguy" in email:
+ deferred.defer(mail.send_mail, sender="Maglock <brian.klug@hackerdojo.com>", to="Emergency Paging System <page@hackerdojo.com>",
+ subject="RFID Entry: " + m.username, body="Lobby entry", _queue="emailthrottle")
+ urlfetch.fetch("http://www.dustball.com/call/call.php?str=RFID+Entry+"+username)
self.response.out.write("OK")
class BadgeChange(db.Model):
Please sign in to comment.
Something went wrong with that request. Please try again.