[Zope3-checkins] CVS: Zope3/src/zope/app/container - sample.py:1.4
Guido van Rossum
guido@python.org
Fri, 27 Dec 2002 14:22:50 -0500
Update of /cvs-repository/Zope3/src/zope/app/container
In directory cvs.zope.org:/tmp/cvs-serv15582
Modified Files:
sample.py
Log Message:
Turns out UnicodeDecodeError is only defined in Python 2.3.
Fortunately, it's a subclass of UnicodeError, and the same condition
raises UnicodeError in Python 2.2. So use that.
=== Zope3/src/zope/app/container/sample.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/container/sample.py:1.3 Fri Dec 27 13:39:02 2002
+++ Zope3/src/zope/app/container/sample.py Fri Dec 27 14:22:50 2002
@@ -11,8 +11,7 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""
-This module provides a sample container implementation.
+"""Sample container implementation.
This is primarily for testing purposes.
@@ -88,8 +87,10 @@
'''See interface IWriteContainer'''
bad = False
if isinstance(key, StringTypes):
- try: unicode(key)
- except UnicodeDecodeError: bad = True
+ try:
+ unicode(key)
+ except UnicodeError:
+ bad = True
else: bad = True
if bad:
raise TypeError(("'%s' is invalid, the key must be an " +
@@ -102,6 +103,3 @@
def __delitem__(self, key):
'''See interface IWriteContainer'''
del self.__data[key]
-
- #
- ############################################################