# HG changeset patch # User Aurelien Campeas # Date 1284629414 -7200 # Node ID c3d98e4bee129234bac00c29a450a15923da7eeb # Parent 9b5c008267b0595f1c6dbdeb26faf8f9b5b1058c [request] memoize tabindex across ajax calls (on pageid) to avoid ui confusion diff -r 9b5c008267b0 -r c3d98e4bee12 web/request.py --- a/web/request.py Thu Sep 16 11:30:09 2010 +0200 +++ b/web/request.py Thu Sep 16 11:30:14 2010 +0200 @@ -99,9 +99,6 @@ # search state: 'normal' or 'linksearch' (eg searching for an object # to create a relation with another) self.search_state = ('normal',) - # tabindex generator - self.tabindexgen = count(1) - self.next_tabindex = self.tabindexgen.next # page id, set by htmlheader template self.pageid = None self._set_pageid() @@ -131,6 +128,13 @@ """ return self.set_varmaker() + def _get_tabindex_func(self): + nextfunc = self.get_page_data('nexttabfunc') + if nextfunc is None: + nextfunc = count(1).next + self.set_page_data('nexttabfunc', nextfunc) + return nextfunc + def set_varmaker(self): varmaker = self.get_page_data('rql_varmaker') if varmaker is None: @@ -143,6 +147,8 @@ or an anonymous connection is open """ super(CubicWebRequestBase, self).set_session(session, user) + # tabindex generator + self.next_tabindex = self._get_tabindex_func() # set request language vreg = self.vreg if self.user: