[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/session/session.py ups, we should return default not None here

Bernd Dorn bernd.dorn at fhv.at
Thu Sep 21 13:38:18 EDT 2006


Log message for revision 70294:
  ups, we should return default not None here

Changed:
  U   Zope3/trunk/src/zope/app/session/session.py

-=-
Modified: Zope3/trunk/src/zope/app/session/session.py
===================================================================
--- Zope3/trunk/src/zope/app/session/session.py	2006-09-21 17:18:17 UTC (rev 70293)
+++ Zope3/trunk/src/zope/app/session/session.py	2006-09-21 17:38:15 UTC (rev 70294)
@@ -343,12 +343,12 @@
             >>> import tests
             >>> request = tests.setUp(PersistentSessionDataContainer)
 
-           If we use get we get None returned as default if the pkg_id
+           If we use get we get None or default returned if the pkg_id
            is not there.
            
-            >>> session = Session(request).get('not.there')
-            >>> session is None
-            True
+            >>> session = Session(request).get('not.there', 'default')
+            >>> session
+            'default'
             
            This method is lazy and does not create the session data.
             >>> session = Session(request).get('not.there')
@@ -374,13 +374,13 @@
         try:
             sd = sdc[self.client_id]
         except KeyError:
-            return None
+            return default
         try:
             return sd[pkg_id]
         except KeyError:
-            return None
+            return default
+        
 
-
     def __getitem__(self, pkg_id):
         """See zope.app.session.interfaces.ISession
 



More information about the Zope3-Checkins mailing list