[tabs] cookie name par cube instance will reduce cookie collisions
authorAurelien Campeas <aurelien.campeas@logilab.fr>
Wed, 28 Jan 2009 16:58:05 +0100
changeset 504 459e50669d96
parent 503 a2fca6cdc5ff
child 505 04f40057fc4d
[tabs] cookie name par cube instance will reduce cookie collisions
web/views/tabs.py
--- a/web/views/tabs.py	Wed Jan 28 16:53:09 2009 +0100
+++ b/web/views/tabs.py	Wed Jan 28 16:58:05 2009 +0100
@@ -55,10 +55,11 @@
 
     def active_tab(self, tabs, default):
         cookie = self.req.get_cookie()
-        activetab = cookie.get('active_tab')
+        cookiename = '%s_active_tab' % self.config.appid
+        activetab = cookie.get(cookiename)
         if activetab is None:
-            cookie['active_tab'] = default
-            self.req.set_cookie(cookie, 'active_tab')
+            cookie[cookiename] = default
+            self.req.set_cookie(cookie, cookiename)
             tab = default
         else:
             tab = activetab.value
@@ -112,8 +113,9 @@
 
 def js_remember_active_tab(self, tabname):
     cookie = self.req.get_cookie()
-    cookie['active_tab'] = tabname
-    self.req.set_cookie(cookie, 'active_tab')
+    cookiename = '%s_active_tab' % self.config.appid
+    cookie[cookiename] = tabname
+    self.req.set_cookie(cookie, cookiename)
 
 def js_lazily(self, vid_eid):
     vid, eid = vid_eid.split('-')