Re: Python 3.3 port of zope.configuration

Brian Sutherland <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <[email protected]>
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
_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.