#-*- 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