Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-02-08 Thread Charlie Clark
Hiya, ... lots cut ... I like the _populateIndexes() method. Having a single pass without a signifying parameter makes it easier to understand. Am 06.02.2012, 10:12 Uhr, schrieb Jan-Carel Brand : A vocabulary must minimally be able to determine whether it contains a value, to create a term

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-02-06 Thread Jan-Carel Brand
On Mon, 2012-01-30 at 15:42 +0100, Charlie Clark wrote: > Am 30.01.2012, 14:33 Uhr, schrieb Jan-Carel Brand : > > ... lots cut ... > > > Yes, the values must be unique, because we do value lookups. > > The "title" attr doesn't have to be unique though. You could have a > > "Forestry" department f

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-30 Thread Souheil CHELFOUH
Snip snip > Marius and Souheil, what do you think about this? I think it probably > still makes sense to have a dict_factory as Souheil suggested, but then > we make the default type OrderedDict and not dict. > This sounds perfectly reasonnable. > Any objections? Not really

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-30 Thread Charlie Clark
Hiya, Am 30.01.2012, 14:33 Uhr, schrieb Jan-Carel Brand : ... lots cut ... Yes, the values must be unique, because we do value lookups. The "title" attr doesn't have to be unique though. You could have a "Forestry" department for two different regions. The title will be the same, but the valu

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-30 Thread Jan-Carel Brand
On Fri, 2012-01-27 at 11:50 +0100, Souheil CHELFOUH wrote: > Yes, Marius got exactly what I meant, this is how I usually make the > not-so-pluggable stuff pluggable :) > About the fact to release it out of zope.schema, it's also to be able > to make it live a bit and prove itself. > Then, including

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-30 Thread Jan-Carel Brand
On Sun, 2012-01-29 at 16:17 +0100, Charlie Clark wrote: > > From the zope.schema 4.0.0 release notes: > > "Port to Python 3. This adds a dependency on six and removes support for > > Python 2.5" > > Shouldn't that also mean a preference of > "for key in _dict" over "for key in _dict.keys()" ? >

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-29 Thread Charlie Clark
Hiya, Am 27.01.2012, 12:56 Uhr, schrieb Jan-Carel Brand : Hang on a minute! While I'm not 100 % convinced of the need in the core I think a separate package just for TreeVocabulary would be splitting hairs. If z3c.form can use it then I think that is justification enough. Justification e

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-27 Thread Jan-Carel Brand
On Thu, 2012-01-26 at 15:42 +0100, Charlie Clark wrote: > Hiya, > > Am 26.01.2012, 15:02 Uhr, schrieb Jan-Carel Brand : > > > Ok, Charlie also expressed his reservations. I'll put it in a different > > package then. > > Hang on a minute! While I'm not 100 % convinced of the need in the core I

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-27 Thread Souheil CHELFOUH
Yes, Marius got exactly what I meant, this is how I usually make the not-so-pluggable stuff pluggable :) About the fact to release it out of zope.schema, it's also to be able to make it live a bit and prove itself. Then, including it and changing the API can be easily justified. I'm not afraid of t

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-26 Thread Marius Gedminas
On Thu, Jan 26, 2012 at 04:02:54PM +0200, Jan-Carel Brand wrote: > On Wed, 2012-01-25 at 18:56 +0100, Souheil CHELFOUH wrote: > > A quick note : > > > > This quite an advanced vocabulary, why not make another package with a > > dependency on zope.schema ? > > I don't quite see the point to have th

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-26 Thread Charlie Clark
Hiya, Am 26.01.2012, 15:02 Uhr, schrieb Jan-Carel Brand : Ok, Charlie also expressed his reservations. I'll put it in a different package then. Hang on a minute! While I'm not 100 % convinced of the need in the core I think a separate package just for TreeVocabulary would be splitting hairs

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-26 Thread Jan-Carel Brand
Hi Souheil On Wed, 2012-01-25 at 18:56 +0100, Souheil CHELFOUH wrote: > A quick note : > > This quite an advanced vocabulary, why not make another package with a > dependency on zope.schema ? > I don't quite see the point to have that in the "core". Ok, Charlie also expressed his reservations. I

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-25 Thread Souheil CHELFOUH
A quick note : This quite an advanced vocabulary, why not make another package with a dependency on zope.schema ? I don't quite see the point to have that in the "core". Furthermore, for the dict class in use in the vocabulary, you could add a "factory" class that can be overriden easily. That wo

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-25 Thread Marius Gedminas
On Wed, Jan 25, 2012 at 01:55:28AM +0200, Jan-Carel Brand wrote: > On Wed, 2012-01-25 at 00:52 +0200, Marius Gedminas wrote: > > On Tue, Jan 24, 2012 at 07:34:03PM +0200, Jan-Carel Brand wrote: > > > I now subclass PersistentMapping instead of SimpleVocabulary, so this is > > > not an issue anymore

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-25 Thread Jan-Carel Brand
Hi Charlie On Wed, 2012-01-25 at 10:37 +0100, Charlie Clark wrote: > Hiya, > > Am 24.01.2012, 18:48 Uhr, schrieb Jan-Carel Brand : > > > I've clarified some of the docstrings and added the missing one. > > None have doctests, perhaps you are referring to fromDict, which gives > > an example dict

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-25 Thread Charlie Clark
Hiya, Am 24.01.2012, 18:48 Uhr, schrieb Jan-Carel Brand : I've clarified some of the docstrings and added the missing one. None have doctests, perhaps you are referring to fromDict, which gives an example dict to show the required structure. I guess that could easily be turned into a doctest, I

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-24 Thread Jan-Carel Brand
On Wed, 2012-01-25 at 00:52 +0200, Marius Gedminas wrote: > On Tue, Jan 24, 2012 at 07:34:03PM +0200, Jan-Carel Brand wrote: > > > Missing tests: by inheriting from SimpleVocabulary you also gain > > > .fromItems() and .fromValues(). Do those work? They pass a list of > > > terms to __init__, whi

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-24 Thread Marius Gedminas
On Tue, Jan 24, 2012 at 07:34:03PM +0200, Jan-Carel Brand wrote: > > Missing tests: by inheriting from SimpleVocabulary you also gain > > .fromItems() and .fromValues(). Do those work? They pass a list of > > terms to __init__, which seems to expect a dict now. Override and add a > > raise NotIm

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-24 Thread Jan-Carel Brand
Hi Charlie On Tue, 2012-01-24 at 15:06 +0100, Charlie Clark wrote: > Hiya, > Am 24.01.2012, 12:35 Uhr, schrieb Jan-Carel Brand : > > > Perhaps I should rephrase > > I would like my changes to be merged with the zope.schema trunk. The > > tests I've added provide 100% coverage of the TreeVocabula

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-24 Thread Jan-Carel Brand
On Tue, 2012-01-24 at 16:07 +0200, Marius Gedminas wrote: > Incidentally, please do not hijack existing threads when you start a new > topic, ok? Yes, that was an honest mistake, no ill intentions. Won't happen again. > On Tue, Jan 24, 2012 at 01:35:49PM +0200, Jan-Carel Brand wrote: > > On Fri,

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-24 Thread Georges Racinet
On 01/24/2012 03:06 PM, Charlie Clark wrote: > Off the top of my head I don't know which Python versions support > classmethods. Classmethods are fine in python2.4 Cheers -- Georges Racinet, http://www.racinet.fr, http://anybox.fr Zope/CPS & OpenERP expertise, assistance & development GPG: 0x48

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-24 Thread Marius Gedminas
Incidentally, please do not hijack existing threads when you start a new topic, ok? On Tue, Jan 24, 2012 at 01:35:49PM +0200, Jan-Carel Brand wrote: > On Fri, 2012-01-20 at 13:50 +0200, Jan-Carel Brand wrote: > > Hi all > > > > I've been working on porting the Dynatree (a dynamic tree-like) widge

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-24 Thread Charlie Clark
Hiya, Am 24.01.2012, 12:35 Uhr, schrieb Jan-Carel Brand : Perhaps I should rephrase I would like my changes to be merged with the zope.schema trunk. The tests I've added provide 100% coverage of the TreeVocabulary code. I've only glanced cursorily at the source but I'm not sure that a merge i

Re: [Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-24 Thread Jan-Carel Brand
On Fri, 2012-01-20 at 13:50 +0200, Jan-Carel Brand wrote: > Hi all > > I've been working on porting the Dynatree (a dynamic tree-like) widget > to z3c.form: > > https://github.com/collective/collective.dynatree > > My (temporary) fork is here: > > https://github.com/syslabcom/collective.dynatre

[Zope-dev] TreeVocabulary in zope.schema.vocabulary

2012-01-20 Thread Jan-Carel Brand
Hi all I've been working on porting the Dynatree (a dynamic tree-like) widget to z3c.form: https://github.com/collective/collective.dynatree My (temporary) fork is here: https://github.com/syslabcom/collective.dynatree And for this I needed a hierarchical tree-like vocabulary. So I've created