[Checkins] SVN: z3c.sessionwidget/trunk/src/z3c/sessionwidget/widget.py use a more unique key for the session

Bernd Dorn bernd.dorn at lovelysystems.com
Tue Feb 20 11:29:21 EST 2007


Log message for revision 72718:
  use a more unique key for the session

Changed:
  U   z3c.sessionwidget/trunk/src/z3c/sessionwidget/widget.py

-=-
Modified: z3c.sessionwidget/trunk/src/z3c/sessionwidget/widget.py
===================================================================
--- z3c.sessionwidget/trunk/src/z3c/sessionwidget/widget.py	2007-02-20 16:27:17 UTC (rev 72717)
+++ z3c.sessionwidget/trunk/src/z3c/sessionwidget/widget.py	2007-02-20 16:29:21 UTC (rev 72718)
@@ -36,9 +36,16 @@
 
     @property
     def session(self):
-        """Get the session containing all data relevant for this widget."""
+        """Get the session containing all data relevant for this
+        widget."""
+        # key from url of context
+        if self.request._traversed_names:
+            key = '/'.join(self.request._traversed_names[:-1] + \
+                           [self.name])
+        else:
+            key = self.name
         return ISession(self.request)[SESSION_KEY].setdefault(
-            self.name, SessionPkgData())
+            key, SessionPkgData())
 
     def setRenderedValue(self, value):
         """See zope.app.form.interfaces.IWidget"""



More information about the Checkins mailing list