Commit 0e778c07 authored by Jim Fulton's avatar Jim Fulton

Fixed bug in get method.

parent 8d18922a
...@@ -85,12 +85,13 @@ ...@@ -85,12 +85,13 @@
__doc__='''Python implementation of persistent base types __doc__='''Python implementation of persistent base types
$Id: PersistentMapping.py,v 1.7 2000/04/21 19:20:50 tseaver Exp $''' $Id: PersistentMapping.py,v 1.8 2000/04/21 20:06:34 jim Exp $'''
__version__='$Revision: 1.7 $'[11:-2] __version__='$Revision: 1.8 $'[11:-2]
import Persistence import Persistence
import types import types
_marker=[]
class PersistentMapping(Persistence.Persistent): class PersistentMapping(Persistence.Persistent):
"""A persistent wrapper for mapping objects. """A persistent wrapper for mapping objects.
...@@ -127,7 +128,11 @@ class PersistentMapping(Persistence.Persistent): ...@@ -127,7 +128,11 @@ class PersistentMapping(Persistence.Persistent):
def copy(self): return self.__class__(self._container.copy()) def copy(self): return self.__class__(self._container.copy())
def get(self, key, default=None): return self._container.get(key, default) def get(self, key, default=_marker):
if default is _marker:
return self._container.get(key)
else:
return self._container.get(key, default)
def has_key(self,key): return self._container.has_key(key) def has_key(self,key): return self._container.has_key(key)
......
...@@ -85,12 +85,13 @@ ...@@ -85,12 +85,13 @@
__doc__='''Python implementation of persistent base types __doc__='''Python implementation of persistent base types
$Id: PersistentMapping.py,v 1.7 2000/04/21 19:20:50 tseaver Exp $''' $Id: PersistentMapping.py,v 1.8 2000/04/21 20:06:34 jim Exp $'''
__version__='$Revision: 1.7 $'[11:-2] __version__='$Revision: 1.8 $'[11:-2]
import Persistence import Persistence
import types import types
_marker=[]
class PersistentMapping(Persistence.Persistent): class PersistentMapping(Persistence.Persistent):
"""A persistent wrapper for mapping objects. """A persistent wrapper for mapping objects.
...@@ -127,7 +128,11 @@ class PersistentMapping(Persistence.Persistent): ...@@ -127,7 +128,11 @@ class PersistentMapping(Persistence.Persistent):
def copy(self): return self.__class__(self._container.copy()) def copy(self): return self.__class__(self._container.copy())
def get(self, key, default=None): return self._container.get(key, default) def get(self, key, default=_marker):
if default is _marker:
return self._container.get(key)
else:
return self._container.get(key, default)
def has_key(self,key): return self._container.has_key(key) def has_key(self,key): return self._container.has_key(key)
......
...@@ -85,12 +85,13 @@ ...@@ -85,12 +85,13 @@
__doc__='''Python implementation of persistent base types __doc__='''Python implementation of persistent base types
$Id: mapping.py,v 1.7 2000/04/21 19:20:50 tseaver Exp $''' $Id: mapping.py,v 1.8 2000/04/21 20:06:34 jim Exp $'''
__version__='$Revision: 1.7 $'[11:-2] __version__='$Revision: 1.8 $'[11:-2]
import Persistence import Persistence
import types import types
_marker=[]
class PersistentMapping(Persistence.Persistent): class PersistentMapping(Persistence.Persistent):
"""A persistent wrapper for mapping objects. """A persistent wrapper for mapping objects.
...@@ -127,7 +128,11 @@ class PersistentMapping(Persistence.Persistent): ...@@ -127,7 +128,11 @@ class PersistentMapping(Persistence.Persistent):
def copy(self): return self.__class__(self._container.copy()) def copy(self): return self.__class__(self._container.copy())
def get(self, key, default=None): return self._container.get(key, default) def get(self, key, default=_marker):
if default is _marker:
return self._container.get(key)
else:
return self._container.get(key, default)
def has_key(self,key): return self._container.has_key(key) def has_key(self,key): return self._container.has_key(key)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment