Skip to content

Commit

Permalink
Update cookie.rst
Browse files Browse the repository at this point in the history
We should reset the 'last_visit' item, because if it's not reset then every subsequent visit after one day will increment the 'visit' item.
  • Loading branch information
ramdog committed Oct 30, 2013
1 parent 654df39 commit 8c86c87
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions chapters/cookie.rst
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ Now if you want to check if the cookie has been stored you can do so by accessin
if (datetime.now() - datetime.strptime(last_visit_time[:-7], "%Y-%m-%d %H:%M:%S")).days > 0:
request.session['visits'] = visits + 1
request.session['last_visit'] = str(datetie.now())
else:
# The get returns None, and the session does not have a value for the last visit.
request.session['last_visit'] = str(datetime.now())
Expand Down

0 comments on commit 8c86c87

Please sign in to comment.