On Fri, May 04, 2012 at 07:50:57PM -0400, Tres Seaver wrote:
On 04/26/2012 02:34 PM, Tres Seaver wrote:
On 04/26/2012 01:50 PM, Brian Sutherland wrote:
On Thu, Apr 26, 2012 at 12:06:13PM -0400, Tres Seaver wrote: On 04/26/2012 04:39 AM, Brian Sutherland wrote:
On Thu, Apr 12, 2012 at 07:37:46PM -0400, Tres Seaver wrote: > Also, do your branches still pass tests on 3.2.x? I'm sort > of keen to see both zope.schema and zope.configuration join > the "2to3-free" camp with zope.event, zope.interface, > zope.i18nmessageid, and zope.exceptions (yes, > zope.configuration, I'm looking at you next).
I see you've started doing this in a better and more rigorous way than I was. So I'm going to abandon my plans to merge in favour of your branches.
I'd still urge you to have a look at my zope.schema branch, which I think solves a real problem with URI fields and Python 3. The patch is pretty small.
My zope.schema branch is largely focused on improving the unittest coverage, while also making the package work with Python 3.2 (i.e., not relying on 3.3's restoration of unicode literals).
I would be glad to look at your branch; I had already considered making the "native string" fields APIs. I'm not sure that I agree that the ASCII / URI / Id / DottedName fields should have native string as its type: can you help by elaborating there?
For DottedName we're basically forced to use native strings as you can import modules with unicode names on python 3:
> from 漢語 import Español print(Español) <class '漢語.Español'>
Id is either a URI or a DottedName. So it must, like DottedName, also be a native string.
As for URI, python 3 library functions seem to not care, so we can choose either:
> from urllib.parse import urlparse > urlparse('http://www.example.com/unicode') ParseResult(scheme='http', netloc='www.example.com', path='/unicode', params='', query='', fragment='') > urlparse(b'http://www.example.com/bytes') ParseResultBytes(scheme=b'http', netloc=b'www.example.com', path=b'/bytes', params=b'', query=b'', fragment=b'')
But, for consistency's sake, URI, Id and DottedName should be the same. That makes the best choice for URI a native string.
Another more practical argument is that having URI be a "native string" made the porting of zope.configuration to python 3 much easier. There were a few nasty bugs when trying it with URI as bytes.
I have no strong argument for ASCII.
FWIW, here's the original discussion on porting zope.schema: https://mail.zope.org/pipermail/zope-dev/2011-October/043540.html
Thanks very much for the explanation. I will plan to merge in your changes in my branch ASAP.
Done and merged to the trunk with my 'test_cleanup' branch.
Looks great, thanks! -- Brian Sutherland