From 023d5f91df872cd5226f3eb31fa3810f30dd5c72 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Wed, 3 Dec 2014 20:49:03 +0000 Subject: [PATCH] Make visitor tracking more robust --- rophako/model/tracking.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rophako/model/tracking.py b/rophako/model/tracking.py index 16c72be..b1f5595 100644 --- a/rophako/model/tracking.py +++ b/rophako/model/tracking.py @@ -37,6 +37,8 @@ def track_visit(request, session): db = dict(hits=0) if JsonDB.exists(dbfile): db = JsonDB.get(dbfile) + if db is None: + db = dict(hits=0) # Update it? if not cookie: @@ -50,6 +52,8 @@ def track_visit(request, session): db = dict() if JsonDB.exists(dbfile): db = JsonDB.get(dbfile) + if db is None: + db = dict() # Update with their IP? if not cookie and not addr in db: