Commit 5a3551c5 authored by Tres Seaver's avatar Tres Seaver

Collector 1064: Allow non-sliceable keys in PersistentMapping

parent 32083263
...@@ -85,10 +85,11 @@ ...@@ -85,10 +85,11 @@
__doc__='''Python implementation of persistent base types __doc__='''Python implementation of persistent base types
$Id: PersistentMapping.py,v 1.5 1999/05/10 23:15:56 jim Exp $''' $Id: PersistentMapping.py,v 1.6 2000/04/13 14:22:54 tseaver Exp $'''
__version__='$Revision: 1.5 $'[11:-2] __version__='$Revision: 1.6 $'[11:-2]
import Persistence import Persistence
import types
class PersistentMapping(Persistence.Persistent): class PersistentMapping(Persistence.Persistent):
"""A persistent wrapper for mapping objects. """A persistent wrapper for mapping objects.
...@@ -137,7 +138,7 @@ class PersistentMapping(Persistence.Persistent): ...@@ -137,7 +138,7 @@ class PersistentMapping(Persistence.Persistent):
try: return self._v_keys try: return self._v_keys
except: pass except: pass
keys=self._v_keys=filter( keys=self._v_keys=filter(
lambda k: k[:1]!='_', lambda k: not isinstance(k,types.StringType) or k[:1]!='_',
self._container.keys()) self._container.keys())
keys.sort() keys.sort()
return keys return keys
......
...@@ -85,10 +85,11 @@ ...@@ -85,10 +85,11 @@
__doc__='''Python implementation of persistent base types __doc__='''Python implementation of persistent base types
$Id: PersistentMapping.py,v 1.5 1999/05/10 23:15:56 jim Exp $''' $Id: PersistentMapping.py,v 1.6 2000/04/13 14:22:54 tseaver Exp $'''
__version__='$Revision: 1.5 $'[11:-2] __version__='$Revision: 1.6 $'[11:-2]
import Persistence import Persistence
import types
class PersistentMapping(Persistence.Persistent): class PersistentMapping(Persistence.Persistent):
"""A persistent wrapper for mapping objects. """A persistent wrapper for mapping objects.
...@@ -137,7 +138,7 @@ class PersistentMapping(Persistence.Persistent): ...@@ -137,7 +138,7 @@ class PersistentMapping(Persistence.Persistent):
try: return self._v_keys try: return self._v_keys
except: pass except: pass
keys=self._v_keys=filter( keys=self._v_keys=filter(
lambda k: k[:1]!='_', lambda k: not isinstance(k,types.StringType) or k[:1]!='_',
self._container.keys()) self._container.keys())
keys.sort() keys.sort()
return keys return keys
......
...@@ -85,10 +85,11 @@ ...@@ -85,10 +85,11 @@
__doc__='''Python implementation of persistent base types __doc__='''Python implementation of persistent base types
$Id: mapping.py,v 1.5 1999/05/10 23:15:56 jim Exp $''' $Id: mapping.py,v 1.6 2000/04/13 14:22:54 tseaver Exp $'''
__version__='$Revision: 1.5 $'[11:-2] __version__='$Revision: 1.6 $'[11:-2]
import Persistence import Persistence
import types
class PersistentMapping(Persistence.Persistent): class PersistentMapping(Persistence.Persistent):
"""A persistent wrapper for mapping objects. """A persistent wrapper for mapping objects.
...@@ -137,7 +138,7 @@ class PersistentMapping(Persistence.Persistent): ...@@ -137,7 +138,7 @@ class PersistentMapping(Persistence.Persistent):
try: return self._v_keys try: return self._v_keys
except: pass except: pass
keys=self._v_keys=filter( keys=self._v_keys=filter(
lambda k: k[:1]!='_', lambda k: not isinstance(k,types.StringType) or k[:1]!='_',
self._container.keys()) self._container.keys())
keys.sort() keys.sort()
return keys return keys
......
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