[Zope3-Users] Re: Annoying thing about schema
Peter Bengtsson
peter at fry-it.com
Thu Jun 5 05:53:19 EDT 2008
2008/6/5 Philipp von Weitershausen <philipp at weitershausen.de>:
> Peter Bengtsson wrote:
>>
>> Suppose you've written this:
>>
>> class ISomething(zope.interface.Interface):
>> foo = zope.schema.TextLine(title="Foo")
>>
>> then you get the error below.
>> First of all, why can't it just help me and just convert the str to a
>> unicode. All it'd need to do is just::
>>
>> title = unicode(title)
>>
>> Django does this.
>> If someone does something bad like `TextLine(title="Ölmage")` that
>> developer should rightly get a UnicodeDecodeError.
>> Secondly, if there is an actual reason for this extreme analism, why
>> can't the error be wrapped into something more user friendly?
>
> Very good points. I think UnicodeDecodeErrors have a bad reputation, though
> (mostly because of Python's stupid implicit conversion). I think Grok's
> policy is very sane in this regard: wherever human-readable text has to be
> entered, either a unicode object or a string just containing ASCII
> characters are acceptable. A very explicit error message stating that exact
> policy should be raised. Look at Grok's error messages, we've tried hard
> making them understandable.
>
This was actually Grok development. But the interface and schema part
is all zope3.
I should have posted to zope3-dev instead.
> I think a proposal on zope3-dev (plus a patch) would be welcomed.
>
I'm not sure how to write the proposal. Can't I just make a feature
request on launchpad or something?
--
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com
More information about the Zope3-users
mailing list