You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

20 lines
510 B

#-*- coding: utf-8 -*-
class PageHistoryMiddleware(object):
"""
If the URLs are stale, reload them.
"""
def process_request(self, request):
if 'history' not in request.session:
request.session['history'] = []
history = request.session['history']
if not request.current_page:
return
page = request.current_page.id
if page not in history:
history = history + [page]
request.session['history'] = history