[Zope3-checkins] CVS: Zope3/src/zope/app/content - folder.py:1.4

Guido van Rossum guido@python.org
Fri, 27 Dec 2002 14:26:26 -0500


Update of /cvs-repository/Zope3/src/zope/app/content
In directory cvs.zope.org:/tmp/cvs-serv16110

Modified Files:
	folder.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/content/folder.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/content/folder.py:1.3	Fri Dec 27 13:39:45 2002
+++ Zope3/src/zope/app/content/folder.py	Fri Dec 27 14:26:26 2002
@@ -79,8 +79,9 @@
         if not (isinstance(name, str) or isinstance(name, unicode)):
             raise TypeError("Name must be a string rather than a %s" %
                             name.__class__.__name__)
-        try: unicode(name)
-        except UnicodeDecodeError:
+        try:
+            unicode(name)
+        except UnicodeError:
             raise TypeError("Name may not contain non-7-bit-ascii codes")
         if not name:
             raise TypeError("Name must not be empty")