Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: Dev

zope.schema and Python 3

 

 

Zope dev RSS feed   Index | Next | Previous | View Threaded


brian at vanguardistas

Oct 10, 2011, 4:14 AM

Post #1 of 9 (366 views)
Permalink
zope.schema and Python 3

I've managed to port zope.schema to Python 3.2 on a branch
(jinty-python3).

It gives up Python 2.5 compatibility and depends on six
(http://packages.python.org/six/). Any objections to me merging this
branch?

--
Brian Sutherland
_______________________________________________
Zope-Dev maillist - Zope-Dev [at] zope
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 )


chrism at plope

Oct 10, 2011, 9:34 AM

Post #2 of 9 (356 views)
Permalink
Re: zope.schema and Python 3 [In reply to]

On Mon, 2011-10-10 at 13:14 +0200, Brian Sutherland wrote:
> I've managed to port zope.schema to Python 3.2 on a branch
> (jinty-python3).

Woo hoo!

> It gives up Python 2.5 compatibility and depends on six
> (http://packages.python.org/six/). Any objections to me merging this
> branch?

Not from me.

- C



_______________________________________________
Zope-Dev maillist - Zope-Dev [at] zope
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 )


brian at vanguardistas

Oct 11, 2011, 1:22 AM

Post #3 of 9 (361 views)
Permalink
Re: zope.schema and Python 3 [In reply to]

On Mon, Oct 10, 2011 at 01:14:26PM +0200, Brian Sutherland wrote:
> I've managed to port zope.schema to Python 3.2 on a branch
> (jinty-python3).

One doubt which has just crept up on me is if these classes:

ASCII, ASCIILine, URI, Id, DottedName

should still inherit from Bytes on Python 3. It seems more logical that
they should inherit from Text. I had to do some gymnastics to keep them
bytes on python 3 and feel all dirty about it.

DottedName, in particular, describes itself as "Python-style dotted
names". But in Python 3 this code works:

>>> from 漢語 import Español
>>> print(Español)
<class '漢語.Español'>

so a DottedName could be '漢語.Español' under Python 3. Definitely
unicode and not Bytes.

However, changing the behaviour of these classes between Python 2 and 3
may be even more problematic.

Another option is simply to have these classes raise NotImplementedError
in their validate() methods under Python 3 and wait till the solution
becomes more obvious.

Anyone out there willing to assuage my doubts?

--
Brian Sutherland
_______________________________________________
Zope-Dev maillist - Zope-Dev [at] zope
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 )


regebro at gmail

Oct 11, 2011, 1:43 AM

Post #4 of 9 (355 views)
Permalink
Re: zope.schema and Python 3 [In reply to]

On Tue, Oct 11, 2011 at 10:22, Brian Sutherland <brian [at] vanguardistas> wrote:
> On Mon, Oct 10, 2011 at 01:14:26PM +0200, Brian Sutherland wrote:
>> I've managed to port zope.schema to Python 3.2 on a branch
>> (jinty-python3).
>
> One doubt which has just crept up on me is if these classes:
>
>    ASCII, ASCIILine, URI, Id, DottedName
>
> should still inherit from Bytes on Python 3. It seems more logical that
> they should inherit from Text. I had to do some gymnastics to keep them
> bytes on python 3 and feel all dirty about it.
>
> DottedName, in particular, describes itself as "Python-style dotted
> names". But in Python 3 this code works:
>
>    >>> from 漢語 import Español
>    >>> print(Español)
>    <class '漢語.Español'>
>
> so a DottedName could be '漢語.Español' under Python 3. Definitely
> unicode and not Bytes.
>
> However, changing the behaviour of these classes between Python 2 and 3
> may be even more problematic.
>
> Another option is simply to have these classes raise NotImplementedError
> in their validate() methods under Python 3 and wait till the solution
> becomes more obvious.
>
> Anyone out there willing to assuage my doubts?

It seems to me that they should be `str`, all of them, except possibly
URI. I'm unsure exactly how that changes the behavior. ASCII/ASCIILine
should have validators to restrict them to ASCII only, reasonably, I
don't know if they already do.

//Lennart
_______________________________________________
Zope-Dev maillist - Zope-Dev [at] zope
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 )


brian at vanguardistas

Oct 11, 2011, 4:33 AM

Post #5 of 9 (355 views)
Permalink
Re: zope.schema and Python 3 [In reply to]

On Tue, Oct 11, 2011 at 10:43:02AM +0200, Lennart Regebro wrote:
> On Tue, Oct 11, 2011 at 10:22, Brian Sutherland <brian [at] vanguardistas> wrote:
> > On Mon, Oct 10, 2011 at 01:14:26PM +0200, Brian Sutherland wrote:
> >> I've managed to port zope.schema to Python 3.2 on a branch
> >> (jinty-python3).
> >
> > One doubt which has just crept up on me is if these classes:
> >
> >    ASCII, ASCIILine, URI, Id, DottedName
> >
> > should still inherit from Bytes on Python 3. It seems more logical that
> > they should inherit from Text. I had to do some gymnastics to keep them
> > bytes on python 3 and feel all dirty about it.
> >
> > DottedName, in particular, describes itself as "Python-style dotted
> > names". But in Python 3 this code works:
> >
> >    >>> from 漢語 import Español
> >    >>> print(Español)
> >    <class '漢語.Español'>
> >
> > so a DottedName could be '漢語.Español' under Python 3. Definitely
> > unicode and not Bytes.
> >
> > However, changing the behaviour of these classes between Python 2 and 3
> > may be even more problematic.
> >
> > Another option is simply to have these classes raise NotImplementedError
> > in their validate() methods under Python 3 and wait till the solution
> > becomes more obvious.
> >
> > Anyone out there willing to assuage my doubts?
>
> It seems to me that they should be `str`, all of them, except possibly
> URI.

Yeah, seems like it. I made this change to all except URI.

> I'm unsure exactly how that changes the behavior. ASCII/ASCIILine
> should have validators to restrict them to ASCII only, reasonably, I
> don't know if they already do.

It has this:

if not max(map(ord, value)) < 128:
raise InvalidValue

which seems like it's enough.

--
Brian Sutherland
_______________________________________________
Zope-Dev maillist - Zope-Dev [at] zope
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 )


brian at vanguardistas

Oct 14, 2011, 3:52 AM

Post #6 of 9 (317 views)
Permalink
Re: zope.schema and Python 3 [In reply to]

On Mon, Oct 10, 2011 at 01:14:26PM +0200, Brian Sutherland wrote:
> I've managed to port zope.schema to Python 3.2 on a branch
> (jinty-python3).
>
> It gives up Python 2.5 compatibility and depends on six
> (http://packages.python.org/six/). Any objections to me merging this
> branch?

I just merged this to trunk.

--
Brian Sutherland
_______________________________________________
Zope-Dev maillist - Zope-Dev [at] zope
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 )


brian at vanguardistas

Nov 7, 2011, 10:09 AM

Post #7 of 9 (225 views)
Permalink
Re: zope.schema and Python 3 [In reply to]

On Fri, Oct 14, 2011 at 12:52:00PM +0200, Brian Sutherland wrote:
> On Mon, Oct 10, 2011 at 01:14:26PM +0200, Brian Sutherland wrote:
> > I've managed to port zope.schema to Python 3.2 on a branch
> > (jinty-python3).
> >
> > It gives up Python 2.5 compatibility and depends on six
> > (http://packages.python.org/six/). Any objections to me merging this
> > branch?
>
> I just merged this to trunk.

Thanks to some great work by Tres, it looks like the buildbots are green
and this change is bedded down.

Could someone release zope.schema trunk?

(or give me rights to do so, jinty on pypi)

--
Brian Sutherland
_______________________________________________
Zope-Dev maillist - Zope-Dev [at] zope
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 )


jim at zope

Nov 7, 2011, 10:38 AM

Post #8 of 9 (220 views)
Permalink
Re: zope.schema and Python 3 [In reply to]

On Mon, Nov 7, 2011 at 1:09 PM, Brian Sutherland
<brian [at] vanguardistas> wrote:
> On Fri, Oct 14, 2011 at 12:52:00PM +0200, Brian Sutherland wrote:
>> On Mon, Oct 10, 2011 at 01:14:26PM +0200, Brian Sutherland wrote:
>> > I've managed to port zope.schema to Python 3.2 on a branch
>> > (jinty-python3).
>> >
>> > It gives up Python 2.5 compatibility and depends on six
>> > (http://packages.python.org/six/). Any objections to me merging this
>> > branch?
>>
>> I just merged this to trunk.
>
> Thanks to some great work by Tres, it looks like the buildbots are green
> and this change is bedded down.
>
> Could someone release zope.schema trunk?
>
> (or give me rights to do so, jinty on pypi)

I empowered you!

:)

Thanks.

Jim

--
Jim Fulton
http://www.linkedin.com/in/jimfulton
_______________________________________________
Zope-Dev maillist - Zope-Dev [at] zope
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 )


brian at vanguardistas

Nov 7, 2011, 11:34 PM

Post #9 of 9 (218 views)
Permalink
Re: zope.schema and Python 3 [In reply to]

On Mon, Nov 07, 2011 at 01:38:21PM -0500, Jim Fulton wrote:
> On Mon, Nov 7, 2011 at 1:09 PM, Brian Sutherland
> <brian [at] vanguardistas> wrote:
> > On Fri, Oct 14, 2011 at 12:52:00PM +0200, Brian Sutherland wrote:
> >> On Mon, Oct 10, 2011 at 01:14:26PM +0200, Brian Sutherland wrote:
> >> > I've managed to port zope.schema to Python 3.2 on a branch
> >> > (jinty-python3).
> >> >
> >> > It gives up Python 2.5 compatibility and depends on six
> >> > (http://packages.python.org/six/). Any objections to me merging this
> >> > branch?
> >>
> >> I just merged this to trunk.
> >
> > Thanks to some great work by Tres, it looks like the buildbots are green
> > and this change is bedded down.
> >
> > Could someone release zope.schema trunk?
> >
> > (or give me rights to do so, jinty on pypi)
>
> I empowered you!
>
> :)

Drat, I forgot the unreleased Python 3 support in zope.testing. Could
you empower me there too?

--
Brian Sutherland
_______________________________________________
Zope-Dev maillist - Zope-Dev [at] zope
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 )

Zope dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.