Re: [Zope-dev] New release for zope.schema

2012-03-23 Thread Jan-Carel Brand
On Fri, 2012-03-23 at 13:12 +0100, Adam GROSZER wrote:
> Hello,
> 
> On Fri, 23 Mar 2012 12:53:51 +0100 you wrote:
> > Hi Adam
> >
> > I guess you saw that Winbot is now happy again:
> > http://winbot.zope.org/builders/zope.schema_py_265_32/builds/456
> >
> > This means we need a 4.1.1 release, right?
> 
> yup

Done. http://pypi.python.org/pypi/zope.schema/4.1.1






___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


Re: [Zope-dev] New release for zope.schema

2012-03-23 Thread Adam GROSZER

Hello,

On Fri, 23 Mar 2012 12:53:51 +0100 you wrote:

Hi Adam

I guess you saw that Winbot is now happy again:
http://winbot.zope.org/builders/zope.schema_py_265_32/builds/456

This means we need a 4.1.1 release, right?


yup

--
Best regards,
 Adam GROSZER
--
Quote of the day:
God has two dwellings: one in heaven, and the other in a meek and 
thankful heart.

- Izaak Walton
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


Re: [Zope-dev] New release for zope.schema

2012-03-23 Thread Jan-Carel Brand
On Fri, 2012-03-23 at 12:29 +0100, Jan-Carel Brand wrote:
> On Fri, 2012-03-23 at 12:16 +0100, Adam GROSZER wrote:
> > Hello,
> > 
> > On Thu, 22 Mar 2012 19:04:29 +0100 you wrote:
> > > Ok, I'll release tomorrow morning when I'm fresh.
> > >
> > 
> > HOLD, winbot has a problem:
> > 
> > FAILED : winbot / zope.schema_py_265_32
> > Build: http://winbot.zope.org/builders/zope.schema_py_265_32/builds/454
> 
> Oh! Damn. This is after the release.
> 
> The error is this:
> 
> > ValueError: path 'src/zope/schema/tests/' cannot end with '/'
> > 
> Which seems related to the MANIFEST.in file I added.
> 
> I've removed now the trailing slash. Hopefully that'll fix it.

Hi Adam

I guess you saw that Winbot is now happy again:
http://winbot.zope.org/builders/zope.schema_py_265_32/builds/456

This means we need a 4.1.1 release, right?

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


Re: [Zope-dev] New release for zope.schema

2012-03-23 Thread Jan-Carel Brand
On Fri, 2012-03-23 at 12:16 +0100, Adam GROSZER wrote:
> Hello,
> 
> On Thu, 22 Mar 2012 19:04:29 +0100 you wrote:
> > Ok, I'll release tomorrow morning when I'm fresh.
> >
> 
> HOLD, winbot has a problem:
> 
> FAILED : winbot / zope.schema_py_265_32
> Build: http://winbot.zope.org/builders/zope.schema_py_265_32/builds/454

Oh! Damn. This is after the release.

The error is this:

> ValueError: path 'src/zope/schema/tests/' cannot end with '/'
> 
Which seems related to the MANIFEST.in file I added.

I've removed now the trailing slash. Hopefully that'll fix it.

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


Re: [Zope-dev] New release for zope.schema

2012-03-23 Thread Jan-Carel Brand
On Thu, 2012-03-22 at 23:03 +0200, Marius Gedminas wrote:
> On Thu, Mar 22, 2012 at 07:04:29PM +0100, Jan-Carel Brand wrote:
> > On Thu, 2012-03-22 at 19:39 +0200, Marius Gedminas wrote:
> > > $ virtualenv -p python3.2 py32
> > > $ py32/bin/python setup.py develop
> > > ... this takes a long time... I miss my buildout egg cache ...
> > > $ py32/bin/pip install zope.testrunner
> > > $ py32/bin/pip install zope.testing  # have to install test extras by 
> > > hand?
> > > $ py32/bin/zope-testrunner --test-path=src
> > > ...
> > > Ran 255 tests with 1 failures and 0 errors in 0.206 seconds.
> > 
> > lol. Yeah, it took me a while to figure it out as well. 
> > 
> > I instead ran: python setup.py test
> > 
> > That also works.
> 
> D'oh! :-)
> 
> > Yeah, as Brian mentioned:
> > https://bugs.launchpad.net/zope.interface/+bug/911851
> 
> Given that zope.schema already requires Python 2.6 or newer, I've committed
> this fix:
> 
> --- src/zope/schema/tests/test_choice.py(revision 124693)
> +++ src/zope/schema/tests/test_choice.py(working copy)
> @@ -16,7 +16,7 @@
>  import unittest
>  
>  from six import u
> -from zope.interface import implements
> +from zope.interface import implementer
>  from zope.schema import vocabulary
>  from zope.schema import Choice
>  from zope.schema.interfaces import ConstraintNotSatisfied
> @@ -114,8 +114,8 @@ class Vocabulary_ChoiceFieldTests(unitte
>  self.assertRaises(ValueError, choice.validate, "value")
>  
> 
> +@implementer(IContextSourceBinder)
>  class SampleContextSourceBinder(object):
> -implements(IContextSourceBinder)
>  def __call__(self, context):
>  return SampleVocabulary()


Thanks! That fixed the last bug.

I've now released zope.schema 4.1.0.
http://pypi.python.org/pypi/zope.schema/4.1.0

-JC 

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


Re: [Zope-dev] New release for zope.schema

2012-03-23 Thread Adam GROSZER

Hello,

On Thu, 22 Mar 2012 19:04:29 +0100 you wrote:

Ok, I'll release tomorrow morning when I'm fresh.



HOLD, winbot has a problem:

FAILED : winbot / zope.schema_py_265_32
Build: http://winbot.zope.org/builders/zope.schema_py_265_32/builds/454


--
Best regards,
 Adam GROSZER
--
Quote of the day:
The charity that hastens to proclaim its good deeds, ceases to be 
charity, and is only pride and ostentation.

- William Hutton
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


Re: [Zope-dev] New release for zope.schema

2012-03-22 Thread Marius Gedminas
On Thu, Mar 22, 2012 at 07:04:29PM +0100, Jan-Carel Brand wrote:
> On Thu, 2012-03-22 at 19:39 +0200, Marius Gedminas wrote:
> > $ virtualenv -p python3.2 py32
> > $ py32/bin/python setup.py develop
> > ... this takes a long time... I miss my buildout egg cache ...
> > $ py32/bin/pip install zope.testrunner
> > $ py32/bin/pip install zope.testing  # have to install test extras by 
> > hand?
> > $ py32/bin/zope-testrunner --test-path=src
> > ...
> > Ran 255 tests with 1 failures and 0 errors in 0.206 seconds.
> 
> lol. Yeah, it took me a while to figure it out as well. 
> 
> I instead ran: python setup.py test
> 
> That also works.

D'oh! :-)

> Yeah, as Brian mentioned:
> https://bugs.launchpad.net/zope.interface/+bug/911851

Given that zope.schema already requires Python 2.6 or newer, I've committed
this fix:

--- src/zope/schema/tests/test_choice.py(revision 124693)
+++ src/zope/schema/tests/test_choice.py(working copy)
@@ -16,7 +16,7 @@
 import unittest
 
 from six import u
-from zope.interface import implements
+from zope.interface import implementer
 from zope.schema import vocabulary
 from zope.schema import Choice
 from zope.schema.interfaces import ConstraintNotSatisfied
@@ -114,8 +114,8 @@ class Vocabulary_ChoiceFieldTests(unitte
 self.assertRaises(ValueError, choice.validate, "value")
 
 
+@implementer(IContextSourceBinder)
 class SampleContextSourceBinder(object):
-implements(IContextSourceBinder)
 def __call__(self, context):
 return SampleVocabulary()
 

Marius Gedminas
-- 
http://pov.lt/ -- Zope 3/BlueBream consulting and development


signature.asc
Description: Digital signature
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


Re: [Zope-dev] New release for zope.schema

2012-03-22 Thread Charlie Clark

Am 22.03.2012, 15:27 Uhr, schrieb Jan-Carel Brand :


Any ideas why this vocabulary doesn't provide it in Python 3?


I think you have to use the @implements class decorator for Python 3.

Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Kronenstr. 27a
Düsseldorf
D- 40217
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


Re: [Zope-dev] New release for zope.schema

2012-03-22 Thread Jan-Carel Brand
On Thu, 2012-03-22 at 19:39 +0200, Marius Gedminas wrote:
> On Thu, Mar 22, 2012 at 03:27:20PM +0100, Jan-Carel Brand wrote:
> > On Thu, 2012-03-22 at 12:19 +0100, Jan-Carel Brand wrote:
> > > Thanks for the review.
> > > 
> > > I've committed my changes and ran the tests with Python 2.6 and 2.7. 
> > > I don't have Python 3.x handy but will compile the latest and test with
> > > that as well.
> > 
> > Ok, I tested zope.schema in python 3.2.2 and there were some errors in
> > test_vocabulary.py that I fixed.
> 
> I'm in awe of your dedication.  I myself don't even know how to run the
> zope.schema testsuite under Python 3:
> 
> $ python3.2 bootstrap.py 
>   File "bootstrap.py", line 63
> exec 
> urllib2.urlopen('http://python-distribute.org/distribute_setup.py'
>^
> SyntaxError: invalid syntax
> 
> Well, ok, I may be exaggerating a bit.
> 
> $ virtualenv -p python3.2 py32
> $ py32/bin/python setup.py develop
> ... this takes a long time... I miss my buildout egg cache ...
> $ py32/bin/pip install zope.testrunner
> $ py32/bin/pip install zope.testing  # have to install test extras by 
> hand?
> $ py32/bin/zope-testrunner --test-path=src
> ...
> Ran 255 tests with 1 failures and 0 errors in 0.206 seconds.

lol. Yeah, it took me a while to figure it out as well. 

I instead ran: python setup.py test

That also works.

> > There is however still one more error when testing with Python 3.2.2,
> > but this is related to the IContextSourceBinder validation changes made
> > by rogerineichen.
> > 
> > First the error:
> > 
> > > FAIL: test_validate_source
> > > (zope.schema.tests.test_choice.ContextSourceBinder_ChoiceFieldTests)
> > > --
> > > Traceback (most recent call last):
> > >   File
> > > "/home/jc/dev/python3.2.2/src/zope.schema/src/zope/schema/tests/test_choice.py",
> > >  line 133, in test_validate_source
> > > choice = Choice(source=s)
> > >   File
> > > "/home/jc/dev/python3.2.2/src/zope.schema/src/zope/schema/_field.py",
> > > line 281, in __init__
> > > IContextSourceBinder.providedBy(vocabulary))
> > > AssertionError
> > > 
> > The vocabulary is of type SampleContextSourceBinder from test_choice.py,
> > which does implement IContextSourceBinder.
> > 
> > > class SampleContextSourceBinder(object):
> > > implements(IContextSourceBinder)
> > > def __call__(self, context):
> > > return SampleVocabulary()
> > > 
> > Looking at it in pdb:
> > 
> > > (Pdb) p vocabulary
> > >  > > 0x3236310>
> > > (Pdb) pp vocabulary.__provides__.__iro__
> > > (,)
> > > 
> > Just to double-check, I looked at this vocabulary in Python 2.7:
> > 
> > > (Pdb) vocabulary.__provides__.__iro__
> > > (,
> > > )
> > > 
> > There it *does* provide IContextSourceBinder.
> > 
> > Any ideas why this vocabulary doesn't provide it in Python 3?
> 
> This smells like a bug in zope.interface, and not in zope.schema:
> 
> $ py32/bin/python
> Python 3.2.2 (default, Sep  5 2011, 22:09:30) 
> [GCC 4.6.1] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from zope.interface import Interface, implements
> >>> class IFoo(Interface): pass
> ... 
> >>> class Foo(object): implements(IFoo)
> ... 
> >>> IFoo.implementedBy(Foo)
> False
> >>> IFoo.providedBy(Foo())
> False
> 
> In other words I don't think it should block the release of zope.schema.

Yeah, as Brian mentioned:
https://bugs.launchpad.net/zope.interface/+bug/911851

Ok, I'll release tomorrow morning when I'm fresh.

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


Re: [Zope-dev] New release for zope.schema

2012-03-22 Thread Brian Sutherland
On Thu, Mar 22, 2012 at 03:27:20PM +0100, Jan-Carel Brand wrote:
> > (Pdb) vocabulary.__provides__.__iro__
> > (,
> > )
> > 
> There it *does* provide IContextSourceBinder.
> 
> Any ideas why this vocabulary doesn't provide it in Python 3?

A variant of this one, perhaps:
https://bugs.launchpad.net/zope.interface/+bug/911851

-- 
Brian Sutherland
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


Re: [Zope-dev] New release for zope.schema

2012-03-22 Thread Marius Gedminas
On Thu, Mar 22, 2012 at 03:27:20PM +0100, Jan-Carel Brand wrote:
> On Thu, 2012-03-22 at 12:19 +0100, Jan-Carel Brand wrote:
> > Thanks for the review.
> > 
> > I've committed my changes and ran the tests with Python 2.6 and 2.7. 
> > I don't have Python 3.x handy but will compile the latest and test with
> > that as well.
> 
> Ok, I tested zope.schema in python 3.2.2 and there were some errors in
> test_vocabulary.py that I fixed.

I'm in awe of your dedication.  I myself don't even know how to run the
zope.schema testsuite under Python 3:

$ python3.2 bootstrap.py 
  File "bootstrap.py", line 63
exec urllib2.urlopen('http://python-distribute.org/distribute_setup.py'
   ^
SyntaxError: invalid syntax

Well, ok, I may be exaggerating a bit.

$ virtualenv -p python3.2 py32
$ py32/bin/python setup.py develop
... this takes a long time... I miss my buildout egg cache ...
$ py32/bin/pip install zope.testrunner
$ py32/bin/pip install zope.testing  # have to install test extras by hand?
$ py32/bin/zope-testrunner --test-path=src
...
Ran 255 tests with 1 failures and 0 errors in 0.206 seconds.

> There is however still one more error when testing with Python 3.2.2,
> but this is related to the IContextSourceBinder validation changes made
> by rogerineichen.
> 
> First the error:
> 
> > FAIL: test_validate_source
> > (zope.schema.tests.test_choice.ContextSourceBinder_ChoiceFieldTests)
> > --
> > Traceback (most recent call last):
> >   File
> > "/home/jc/dev/python3.2.2/src/zope.schema/src/zope/schema/tests/test_choice.py",
> >  line 133, in test_validate_source
> > choice = Choice(source=s)
> >   File
> > "/home/jc/dev/python3.2.2/src/zope.schema/src/zope/schema/_field.py",
> > line 281, in __init__
> > IContextSourceBinder.providedBy(vocabulary))
> > AssertionError
> > 
> The vocabulary is of type SampleContextSourceBinder from test_choice.py,
> which does implement IContextSourceBinder.
> 
> > class SampleContextSourceBinder(object):
> > implements(IContextSourceBinder)
> > def __call__(self, context):
> > return SampleVocabulary()
> > 
> Looking at it in pdb:
> 
> > (Pdb) p vocabulary
> >  > 0x3236310>
> > (Pdb) pp vocabulary.__provides__.__iro__
> > (,)
> > 
> Just to double-check, I looked at this vocabulary in Python 2.7:
> 
> > (Pdb) vocabulary.__provides__.__iro__
> > (,
> > )
> > 
> There it *does* provide IContextSourceBinder.
> 
> Any ideas why this vocabulary doesn't provide it in Python 3?

This smells like a bug in zope.interface, and not in zope.schema:

$ py32/bin/python
Python 3.2.2 (default, Sep  5 2011, 22:09:30) 
[GCC 4.6.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from zope.interface import Interface, implements
>>> class IFoo(Interface): pass
... 
>>> class Foo(object): implements(IFoo)
... 
>>> IFoo.implementedBy(Foo)
False
>>> IFoo.providedBy(Foo())
False

In other words I don't think it should block the release of zope.schema.

Marius Gedminas
-- 
http://pov.lt/ -- Zope 3/BlueBream consulting and development


signature.asc
Description: Digital signature
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


Re: [Zope-dev] New release for zope.schema

2012-03-22 Thread Jan-Carel Brand
On Thu, 2012-03-22 at 19:07 +0200, Marius Gedminas wrote:
> On Thu, Mar 22, 2012 at 12:19:39PM +0100, Jan-Carel Brand wrote:
> > On Wed, 2012-03-21 at 19:58 +0200, Marius Gedminas wrote:
> > > Also, would you like to have PyPI access to zope.schema, so that you can
> > > do the release yourself?  If so, tell us your PyPI username.
> > 
> > Sure, my pypi username is: jcbrand
> 
> You now have PyPI access to zope.schema.
> 
> 
> One detail I may have forgotten to mention about the release process:
> sometimes setup.py sdist produces an incomplete archive.  This happens
> every time Subversion changes its working tree format, until somebody
> patches setuptools to understand it.  I think subversion 1.7 changed the
> format again; I don't know if setuptools can handle it yet -- I'm still
> on svn 1.6 myself.
> 
> So it may be a good idea to run python setup.py sdist and compare the
> file list in dists/*.tar.gz with the file list in the current PyPI
> archive, before you actually do the release with fullrelease.  Actually
> zest.releaser's fullrelease has lots of "continue? [y/n]" prompts that
> let you do the inspection before the final upload.  I just feel better
> when I do it by hand, on those rare occasions when I'm not sure about
> the state of my setuptools after a distro upgrade.  YMMV.  And the
> chances of breakage are low, and people generally notice it pretty
> quickly, and uploading a fixed 4.1.1 is easy (edit MANIFEST.in to make
> sure everything is included), so I don't even know why I'm mentioning
> all this.  For completeness, I guess...

Thanks, it's helpful.

setuptools also doesn't play nicely with git. So I've had to edit
MANIFESET.in before. I'll double check manually.

There is however still the Python 3 bug in zope.schema. (See my previous
post).

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


Re: [Zope-dev] New release for zope.schema

2012-03-22 Thread Marius Gedminas
On Thu, Mar 22, 2012 at 12:19:39PM +0100, Jan-Carel Brand wrote:
> On Wed, 2012-03-21 at 19:58 +0200, Marius Gedminas wrote:
> > Also, would you like to have PyPI access to zope.schema, so that you can
> > do the release yourself?  If so, tell us your PyPI username.
> 
> Sure, my pypi username is: jcbrand

You now have PyPI access to zope.schema.


One detail I may have forgotten to mention about the release process:
sometimes setup.py sdist produces an incomplete archive.  This happens
every time Subversion changes its working tree format, until somebody
patches setuptools to understand it.  I think subversion 1.7 changed the
format again; I don't know if setuptools can handle it yet -- I'm still
on svn 1.6 myself.

So it may be a good idea to run python setup.py sdist and compare the
file list in dists/*.tar.gz with the file list in the current PyPI
archive, before you actually do the release with fullrelease.  Actually
zest.releaser's fullrelease has lots of "continue? [y/n]" prompts that
let you do the inspection before the final upload.  I just feel better
when I do it by hand, on those rare occasions when I'm not sure about
the state of my setuptools after a distro upgrade.  YMMV.  And the
chances of breakage are low, and people generally notice it pretty
quickly, and uploading a fixed 4.1.1 is easy (edit MANIFEST.in to make
sure everything is included), so I don't even know why I'm mentioning
all this.  For completeness, I guess...


Marius Gedminas
-- 
If you sat a monkey down in front of a keyboard, the first thing typed would be
a unix command.
-- Bill Lye


signature.asc
Description: Digital signature
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


Re: [Zope-dev] New release for zope.schema

2012-03-22 Thread Jan-Carel Brand
On Thu, 2012-03-22 at 12:19 +0100, Jan-Carel Brand wrote:



> Thanks for the review.
> 
> I've committed my changes and ran the tests with Python 2.6 and 2.7. 
> I don't have Python 3.x handy but will compile the latest and test with
> that as well.

Ok, I tested zope.schema in python 3.2.2 and there were some errors in
test_vocabulary.py that I fixed.

They were all related to the KeysView and ValuesView objects (being
returned by keys() and values() on an OrderedDict) not being indexable.

There is however still one more error when testing with Python 3.2.2,
but this is related to the IContextSourceBinder validation changes made
by rogerineichen.

First the error:

> FAIL: test_validate_source
> (zope.schema.tests.test_choice.ContextSourceBinder_ChoiceFieldTests)
> --
> Traceback (most recent call last):
>   File
> "/home/jc/dev/python3.2.2/src/zope.schema/src/zope/schema/tests/test_choice.py",
>  line 133, in test_validate_source
> choice = Choice(source=s)
>   File
> "/home/jc/dev/python3.2.2/src/zope.schema/src/zope/schema/_field.py",
> line 281, in __init__
> IContextSourceBinder.providedBy(vocabulary))
> AssertionError
> 
The vocabulary is of type SampleContextSourceBinder from test_choice.py,
which does implement IContextSourceBinder.

> class SampleContextSourceBinder(object):
> implements(IContextSourceBinder)
> def __call__(self, context):
> return SampleVocabulary()
> 
Looking at it in pdb:

> (Pdb) p vocabulary
>  0x3236310>
> (Pdb) pp vocabulary.__provides__.__iro__
> (,)
> 
Just to double-check, I looked at this vocabulary in Python 2.7:

> (Pdb) vocabulary.__provides__.__iro__
> (,
> )
> 
There it *does* provide IContextSourceBinder.

Any ideas why this vocabulary doesn't provide it in Python 3?

Regards
JC

___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


Re: [Zope-dev] New release for zope.schema

2012-03-22 Thread Jan-Carel Brand
On Wed, 2012-03-21 at 19:58 +0200, Marius Gedminas wrote:
> On Wed, Mar 21, 2012 at 05:29:44PM +0100, Jan-Carel Brand wrote:
> > What needs to be done for a new release of zope.schema? (4.1)
> 
> (Note: historically zope.schema always used three version components:
> 4.1.0, not 4.1.)

Ok.

> Somebody with interest and PyPI access has to check it out and run
> fullrelease (from zest.releaser).  Ideally, after running the test suite
> to make sure it passes.  For all supported Python versions, if possible.
> Which are, ideally, enumerated in setup.py as Trove classifiers.
> 
> For packages that have C extension modules there are probably extra
> steps needed to produce Windows binary eggs.  I don't know those
> steps (winbot is involved somehow), so I avoid making releases of
> packages that have C extension modules.  How do I check if a package
> has C extension modules?  I go to PyPI and look if there are Windows
> binary eggs available for download for the current version.
> zope.schema doesn't, so I'm just including this for general
> reference purposes.
> 
> > And is there anything I can do to help speed it up?
> 
> Yes: you can bring it up on the mailing list, like you've done here.  ;)
> 
> Also, thank you for the convenient diff.  I'll review it.
> 
> Also, would you like to have PyPI access to zope.schema, so that you can
> do the release yourself?  If so, tell us your PyPI username.

Sure, my pypi username is: jcbrand
> 
> > Even just an alpha/beta release would be very helpful.
> 
> I think uploading alpha/beta releases to PyPI is frowned upon, because
> tools tend to download them blindly, as if they were final releases.

Ok.

> 
> > svn --non-interactive diff 
> > http://svn.zope.org/repos/main/zope.schema/tags/4.0.1 
> > http://svn.zope.org/repos/main/zope.schema/trunk
> > Index: CHANGES.txt
> > ===
> > --- CHANGES.txt (.../tags/4.0.1)(revision 124658)
> > +++ CHANGES.txt (.../trunk) (revision 124658)
> > @@ -2,6 +2,18 @@
> >  CHANGES
> >  ===
> >  
> > +4.1 (unreleased)
> 
> This should be 4.1.0.
> 
> > +--
> > +
> > +- Add TreeVocabulary for nested tree-like vocabularies.
> > +
> > +- Fix broken Object field validation where the schema contains a Choice 
> > with
> > +  ICountextSourceBinder source. In this case the vocabulary was not 
> > iterable
> > +  because the field was not bound and the source binder dien't return the 
> 
> Spelling: dien't.

Fixed.

> > +  real vocabulary. Added simple test for IContextSourceBinder validation. 
> > But a
> > +  test with an Object field with a schema using a Choice with
> > +  IContextSourceBinder is still missing.
> > +
> >  4.0.1 (2011-11-14)
> >  --
> >  
> > Index: setup.py
> > ===
> > --- setup.py(.../tags/4.0.1)(revision 124658)
> > +++ setup.py(.../trunk) (revision 124658)
> > @@ -19,6 +19,7 @@
> >  """Setup for zope.schema package
> >  """
> >  import os
> > +import sys
> >  from setuptools import setup, find_packages
> >  
> >  def read(*rnames):
> > @@ -60,8 +61,18 @@
> >  suite.addTest(mod.test_suite())
> >  return suite
> >  
> > +REQUIRES = [
> > +'setuptools',
> > +'zope.interface >= 3.6.0',
> > +'zope.event',
> > +'six',
> > +]
> > +
> > +if sys.version_info < (2 , 7):
> 
> No space before the comma.

Fixed.

> > +REQUIRES += ['ordereddict'],
> 
> Trailing comma warning!  I do not think this does what you want it to
> do:
> 
> >>> REQUIRES = [
> ... 'setuptools',
> ... 'zope.interface >= 3.6.0',
> ... 'zope.event',
> ... 'six',
> ... ]
> >>> REQUIRES += ['ordereddict'],
> >>> REQUIRES
> ['setuptools', 'zope.interface >= 3.6.0', 'zope.event', 'six', 
> ['ordereddict']]
> 
> I don't know if setuptools can handle this correctly, but it feels wrong
> anyway.  Please fix.

Strange, it seems to work with the comma, because I used/tested it with
python 2.6.

In any case, I removed it now.

> > +
> >  setup(name='zope.schema',
> > -  version = '4.0.1',
> > +  version = '4.1dev',
> 
> This should be '4.1.0dev'.

Done.

> >url='http://pypi.python.org/pypi/zope.schema',
> >license='ZPL 2.1',
> >description='zope.interface extension for defining data schemas',
> > @@ -81,11 +92,8 @@
> >namespace_packages=['zope',],
> >extras_require={'test': ['zope.testing'],
> >'docs': ['z3c.recipe.sphinxdoc']},
> > -  install_requires=['setuptools',
> > -'zope.interface >= 3.6.0',
> > -'zope.event',
> > -'six',
> > -   ],
> > +  install_requires=REQUIRES,
> > +  
> 
> The blank line (and trailing whitespace) do not s

Re: [Zope-dev] New release for zope.schema

2012-03-21 Thread Marius Gedminas
On Wed, Mar 21, 2012 at 08:31:39PM +0100, Hanno Schlichting wrote:
> On Wed, Mar 21, 2012 at 6:58 PM, Marius Gedminas  wrote:
> >    For packages that have C extension modules there are probably extra
> >    steps needed to produce Windows binary eggs.  I don't know those
> >    steps (winbot is involved somehow), so I avoid making releases of
> >    packages that have C extension modules.  How do I check if a package
> >    has C extension modules?  I go to PyPI and look if there are Windows
> >    binary eggs available for download for the current version.
> >    zope.schema doesn't, so I'm just including this for general
> >    reference purposes.
> 
> The point of winbot is to take away all the pain and it does so.
> 
> There's no extra steps at all for packages containing C extensions.
> Just make sure you create a release with a proper tag - winbot does
> the rest.

Oh, that is awesome!

Marius Gedminas
-- 
http://pov.lt/ -- Zope 3/BlueBream consulting and development


signature.asc
Description: Digital signature
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


Re: [Zope-dev] New release for zope.schema

2012-03-21 Thread Hanno Schlichting
On Wed, Mar 21, 2012 at 6:58 PM, Marius Gedminas  wrote:
>    For packages that have C extension modules there are probably extra
>    steps needed to produce Windows binary eggs.  I don't know those
>    steps (winbot is involved somehow), so I avoid making releases of
>    packages that have C extension modules.  How do I check if a package
>    has C extension modules?  I go to PyPI and look if there are Windows
>    binary eggs available for download for the current version.
>    zope.schema doesn't, so I'm just including this for general
>    reference purposes.

The point of winbot is to take away all the pain and it does so.

There's no extra steps at all for packages containing C extensions.
Just make sure you create a release with a proper tag - winbot does
the rest.

Hanno
___
Zope-Dev maillist  -  Zope-Dev@zope.org
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 )


Re: [Zope-dev] New release for zope.schema

2012-03-21 Thread Marius Gedminas
On Wed, Mar 21, 2012 at 05:29:44PM +0100, Jan-Carel Brand wrote:
> What needs to be done for a new release of zope.schema? (4.1)

(Note: historically zope.schema always used three version components:
4.1.0, not 4.1.)

Somebody with interest and PyPI access has to check it out and run
fullrelease (from zest.releaser).  Ideally, after running the test suite
to make sure it passes.  For all supported Python versions, if possible.
Which are, ideally, enumerated in setup.py as Trove classifiers.

For packages that have C extension modules there are probably extra
steps needed to produce Windows binary eggs.  I don't know those
steps (winbot is involved somehow), so I avoid making releases of
packages that have C extension modules.  How do I check if a package
has C extension modules?  I go to PyPI and look if there are Windows
binary eggs available for download for the current version.
zope.schema doesn't, so I'm just including this for general
reference purposes.

> And is there anything I can do to help speed it up?

Yes: you can bring it up on the mailing list, like you've done here.  ;)

Also, thank you for the convenient diff.  I'll review it.

Also, would you like to have PyPI access to zope.schema, so that you can
do the release yourself?  If so, tell us your PyPI username.

> Even just an alpha/beta release would be very helpful.

I think uploading alpha/beta releases to PyPI is frowned upon, because
tools tend to download them blindly, as if they were final releases.

> svn --non-interactive diff 
> http://svn.zope.org/repos/main/zope.schema/tags/4.0.1 
> http://svn.zope.org/repos/main/zope.schema/trunk
> Index: CHANGES.txt
> ===
> --- CHANGES.txt   (.../tags/4.0.1)(revision 124658)
> +++ CHANGES.txt   (.../trunk) (revision 124658)
> @@ -2,6 +2,18 @@
>  CHANGES
>  ===
>  
> +4.1 (unreleased)

This should be 4.1.0.

> +--
> +
> +- Add TreeVocabulary for nested tree-like vocabularies.
> +
> +- Fix broken Object field validation where the schema contains a Choice with
> +  ICountextSourceBinder source. In this case the vocabulary was not iterable
> +  because the field was not bound and the source binder dien't return the 

Spelling: dien't.

> +  real vocabulary. Added simple test for IContextSourceBinder validation. 
> But a
> +  test with an Object field with a schema using a Choice with
> +  IContextSourceBinder is still missing.
> +
>  4.0.1 (2011-11-14)
>  --
>  
> Index: setup.py
> ===
> --- setup.py  (.../tags/4.0.1)(revision 124658)
> +++ setup.py  (.../trunk) (revision 124658)
> @@ -19,6 +19,7 @@
>  """Setup for zope.schema package
>  """
>  import os
> +import sys
>  from setuptools import setup, find_packages
>  
>  def read(*rnames):
> @@ -60,8 +61,18 @@
>  suite.addTest(mod.test_suite())
>  return suite
>  
> +REQUIRES = [
> +'setuptools',
> +'zope.interface >= 3.6.0',
> +'zope.event',
> +'six',
> +]
> +
> +if sys.version_info < (2 , 7):

No space before the comma.

> +REQUIRES += ['ordereddict'],

Trailing comma warning!  I do not think this does what you want it to
do:

>>> REQUIRES = [
... 'setuptools',
... 'zope.interface >= 3.6.0',
... 'zope.event',
... 'six',
... ]
>>> REQUIRES += ['ordereddict'],
>>> REQUIRES
['setuptools', 'zope.interface >= 3.6.0', 'zope.event', 'six', 
['ordereddict']]

I don't know if setuptools can handle this correctly, but it feels wrong
anyway.  Please fix.

> +
>  setup(name='zope.schema',
> -  version = '4.0.1',
> +  version = '4.1dev',

This should be '4.1.0dev'.

>url='http://pypi.python.org/pypi/zope.schema',
>license='ZPL 2.1',
>description='zope.interface extension for defining data schemas',
> @@ -81,11 +92,8 @@
>namespace_packages=['zope',],
>extras_require={'test': ['zope.testing'],
>'docs': ['z3c.recipe.sphinxdoc']},
> -  install_requires=['setuptools',
> -'zope.interface >= 3.6.0',
> -'zope.event',
> -'six',
> -   ],
> +  install_requires=REQUIRES,
> +  

The blank line (and trailing whitespace) do not seem to be useful here.

>classifiers=[
>  "Development Status :: 5 - Production/Stable",
>  "Intended Audience :: Developers",
> Index: src/zope/schema/fields.txt
> ===
> --- src/zope/schema/fields.txt(.../tags/4.0.1)(revision 
> 124658)
> +++ src/zope/schema/fields.txt(.../trunk) (revision 124658)
> @@ -116,6 +116,9 @@
>  The vocabulary interface is simple enough that writing a custom vocabulary is
>  not

[Zope-dev] New release for zope.schema

2012-03-21 Thread Jan-Carel Brand
Hi folks

What needs to be done for a new release of zope.schema? (4.1)
And is there anything I can do to help speed it up?

Even just an alpha/beta release would be very helpful.

Thanks
JC
svn --non-interactive diff http://svn.zope.org/repos/main/zope.schema/tags/4.0.1 http://svn.zope.org/repos/main/zope.schema/trunk
Index: CHANGES.txt
===
--- CHANGES.txt	(.../tags/4.0.1)	(revision 124658)
+++ CHANGES.txt	(.../trunk)	(revision 124658)
@@ -2,6 +2,18 @@
 CHANGES
 ===
 
+4.1 (unreleased)
+--
+
+- Add TreeVocabulary for nested tree-like vocabularies.
+
+- Fix broken Object field validation where the schema contains a Choice with
+  ICountextSourceBinder source. In this case the vocabulary was not iterable
+  because the field was not bound and the source binder dien't return the 
+  real vocabulary. Added simple test for IContextSourceBinder validation. But a
+  test with an Object field with a schema using a Choice with
+  IContextSourceBinder is still missing.
+
 4.0.1 (2011-11-14)
 --
 
Index: setup.py
===
--- setup.py	(.../tags/4.0.1)	(revision 124658)
+++ setup.py	(.../trunk)	(revision 124658)
@@ -19,6 +19,7 @@
 """Setup for zope.schema package
 """
 import os
+import sys
 from setuptools import setup, find_packages
 
 def read(*rnames):
@@ -60,8 +61,18 @@
 suite.addTest(mod.test_suite())
 return suite
 
+REQUIRES = [
+'setuptools',
+'zope.interface >= 3.6.0',
+'zope.event',
+'six',
+]
+
+if sys.version_info < (2 , 7):
+REQUIRES += ['ordereddict'],
+
 setup(name='zope.schema',
-  version = '4.0.1',
+  version = '4.1dev',
   url='http://pypi.python.org/pypi/zope.schema',
   license='ZPL 2.1',
   description='zope.interface extension for defining data schemas',
@@ -81,11 +92,8 @@
   namespace_packages=['zope',],
   extras_require={'test': ['zope.testing'],
   'docs': ['z3c.recipe.sphinxdoc']},
-  install_requires=['setuptools',
-'zope.interface >= 3.6.0',
-'zope.event',
-'six',
-   ],
+  install_requires=REQUIRES,
+  
   classifiers=[
 "Development Status :: 5 - Production/Stable",
 "Intended Audience :: Developers",
Index: src/zope/schema/fields.txt
===
--- src/zope/schema/fields.txt	(.../tags/4.0.1)	(revision 124658)
+++ src/zope/schema/fields.txt	(.../trunk)	(revision 124658)
@@ -116,6 +116,9 @@
 The vocabulary interface is simple enough that writing a custom vocabulary is
 not too difficult itself.
 
+See for example zope.schema.vocabulary.TreeVocabulary for another
+IBaseVocabulary supporting vocabulary that provides a nested, tree-like structure.
+
 Choices and Collections
 ---
 
@@ -156,3 +159,4 @@
 
 This level of indirection may be unnecessary for some applications, and can be
 disabled with simple ZCML changes within `zope.app`.
+
Index: src/zope/schema/vocabulary.py
===
--- src/zope/schema/vocabulary.py	(.../tags/4.0.1)	(revision 124658)
+++ src/zope/schema/vocabulary.py	(.../trunk)	(revision 124658)
@@ -13,14 +13,19 @@
 ##
 """Vocabulary support for schema.
 """
+try:
+from collections import OrderedDict
+except:
+from ordereddict import OrderedDict
+
 from zope.interface.declarations import directlyProvides, implementer
 from zope.schema.interfaces import ValidationError
 from zope.schema.interfaces import IVocabularyRegistry
 from zope.schema.interfaces import IVocabulary, IVocabularyTokenized
+from zope.schema.interfaces import ITreeVocabulary
 from zope.schema.interfaces import ITokenizedTerm, ITitledTokenizedTerm
 
 # simple vocabularies performing enumerated-like tasks
-
 _marker = object()
 
 @implementer(ITokenizedTerm)
@@ -68,6 +73,7 @@
 if interfaces:
 directlyProvides(self, *interfaces)
 
+@classmethod
 def fromItems(cls, items, *interfaces):
 """Construct a vocabulary from a list of (token, value) pairs.
 
@@ -80,8 +86,8 @@
 """
 terms = [cls.createTerm(value, token) for (token, value) in items]
 return cls(terms, *interfaces)
-fromItems = classmethod(fromItems)
 
+@classmethod
 def fromValues(cls, values, *interfaces):
 """Construct a vocabulary from a simple list.
 
@@ -96,8 +102,8 @@
 """
 terms = [cls.createTerm(value) for value in values]
 return cls(terms, *interfaces)
-fromValues = classmethod(fromValues)
 
+@classmethod
 def createTerm(cls, *args):
 """Create a single term from data.
 
@@ -105,7 +111,6 @@
 a term of the appropri