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

R. David Murray rdmurray+dated+1043263133.f8c08d@bitdance.com
Fri, 17 Jan 2003 14:18:44 -0500


Florent writes:
>In article <200212271839.gBRIdj408002@cvs.baymountain.com> you write:
>>          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:
>> +            raise TypeError("Name may not contain non-7-bit-ascii codes")

>Why is that? Is this only temporary until we have Unicode encoding in URLs?
>From my understanding of the discussions we had sometime ago, it is
>imperative to allow any Unicode character (except '/') in a name.

The error message is broken, not the code.

unicode(name) will not raise an error if name is valid unicode.  If
name is ASCII, it will raise a TypeError if name contains non-7-bit
ascii.  We need to prevent non-7-bit ascii precisely to support
unicode.

I've checked in an imporovement (I hope it's an improvement <grin>) to
the error message.

--RDM