diff -r 1a23781534a2 -r 40c7c2cf0797 web/views/tabs.py --- a/web/views/tabs.py Wed Feb 11 18:47:12 2009 +0100 +++ b/web/views/tabs.py Wed Feb 11 19:11:55 2009 +0100 @@ -60,9 +60,13 @@ class TabsMixin(LazyViewMixin): + @property + def cookie_name(self): + return str('%s_active_tab' % self.config.appid) + def active_tab(self, tabs, default): cookie = self.req.get_cookie() - cookiename = '%s_active_tab' % self.config.appid + cookiename = self.cookie_name activetab = cookie.get(cookiename) if activetab is None: cookie[cookiename] = default @@ -97,7 +101,7 @@ for tab in tabs: w(u'
  • ') w(u'' % tab) - w(u'' % tab) + w(u'' % (tab, self.cookie_name)) w(self.req._(tab)) w(u'') w(u'') @@ -112,17 +116,11 @@ # because the callback binding needs to be done before self.req.html_headers.add_onload(u""" jQuery('#entity-tabs > ul').tabs( { selected: %(tabindex)s }); - set_tab('%(vid)s'); - """ % {'tabindex' : tabs.index(active_tab), - 'vid' : active_tab}) - + set_tab('%(vid)s', '%(cookiename)s'); + """ % {'tabindex' : tabs.index(active_tab), + 'vid' : active_tab, + 'cookiename' : self.cookie_name}) -@monkeypatch(JSonController) -def js_remember_active_tab(self, tabname): - cookie = self.req.get_cookie() - cookiename = '%s_active_tab' % self.config.appid - cookie[cookiename] = tabname - self.req.set_cookie(cookie, cookiename) class EntityRelatedTab(EntityView): """A view you should inherit from leftmost,