Re: [Zope-dev] Undo product stops working with recent Zope (StorageTransactionError)

2012-01-24 Thread lists
On Tue, 24 Jan 2012 14:50:44 +0100, Hanno Schlichting
 wrote:
> On Tue, Jan 24, 2012 at 2:14 PM,   wrote:
>> It used to work, but with the most recent versions of
>> Zope this error appears if the Undo by date is used
>> more than once:
> 
> The undo API has changed with ZODB 3.10. As noted in the changelog:
> 
> "The API for undoing multiple transactions has changed. To undo
> multiple transactions in a single transaction, pass a list of
> transaction identifiers to a database's undoMultiple method. Calling a
> database's undo method multiple times in the same transaction now
> raises an exception."
> 
> Your code calls undo multiple times, and needs to be changed accordingly.

Aha.  OK, thanks! :)

Regards,

Morten
___
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 )


[Zope-dev] zope-tests - FAILED: 23, OK: 44

2012-01-24 Thread Zope tests summarizer
This is the summary for test reports received on the 
zope-tests list between 2012-01-23 00:00:00 UTC and 2012-01-24 00:00:00 UTC:

See the footnotes for test reports of unsuccessful builds.

An up-to date view of the builders is also available in our 
buildbot documentation: 
http://docs.zope.org/zopetoolkit/process/buildbots.html#the-nightly-builds

Reports received


[1]ZTK 1.0 / Python2.4.6 Linux 64bit
[2]ZTK 1.0 / Python2.5.5 Linux 64bit
   ZTK 1.0 / Python2.6.7 Linux 64bit
[3]ZTK 1.0dev / Python2.4.6 Linux 64bit
[4]ZTK 1.0dev / Python2.5.5 Linux 64bit
   ZTK 1.0dev / Python2.6.7 Linux 64bit
[5]ZTK 1.1 / Python2.5.5 Linux 64bit
   ZTK 1.1 / Python2.6.7 Linux 64bit
   ZTK 1.1 / Python2.7.2 Linux 64bit
[6]ZTK 1.1dev / Python2.5.5 Linux 64bit
   ZTK 1.1dev / Python2.6.7 Linux 64bit
   ZTK 1.1dev / Python2.7.2 Linux 64bit
   Zope 3.4 KGS / Python2.4.6 64bit linux
   Zope 3.4 KGS / Python2.5.5 64bit linux
   Zope 3.4 Known Good Set / py2.4-32bit-linux
   Zope 3.4 Known Good Set / py2.4-64bit-linux
   Zope 3.4 Known Good Set / py2.5-32bit-linux
   Zope 3.4 Known Good Set / py2.5-64bit-linux
   Zope Buildbot / zope2.12-py2.6 slave-ubuntu32
   Zope Buildbot / zope2.12-py2.6 slave-ubuntu64
   Zope Buildbot / zope2.13-py2.6 slave-ubuntu32
   Zope Buildbot / zope2.13-py2.6 slave-ubuntu64
   Zope Buildbot / zope2.13-py2.7 slave-ubuntu32
   Zope Buildbot / zope2.13-py2.7 slave-ubuntu64
   Zope Buildbot / zope2.14-py2.6 slave-ubuntu32
   Zope Buildbot / zope2.14-py2.6 slave-ubuntu64
   Zope Buildbot / zope2.14-py2.7 slave-ubuntu32
   Zope Buildbot / zope2.14-py2.7 slave-ubuntu64
[7]Zope Buildbot / zopetoolkit-1.0-py2.4 slave-ubuntu32
[8]Zope Buildbot / zopetoolkit-1.0-py2.4 slave-ubuntu64
[9]Zope Buildbot / zopetoolkit-1.0-py2.5 slave-ubuntu32
[10]   Zope Buildbot / zopetoolkit-1.0-py2.5 slave-ubuntu64
[11]   Zope Buildbot / zopetoolkit-1.0-py2.6 slave-ubuntu32
[12]   Zope Buildbot / zopetoolkit-1.0-py2.6 slave-ubuntu64
[13]   Zope Buildbot / zopetoolkit-1.1-py2.5 slave-ubuntu32
[14]   Zope Buildbot / zopetoolkit-1.1-py2.5 slave-ubuntu64
[15]   Zope Buildbot / zopetoolkit-1.1-py2.6 slave-ubuntu32
[16]   Zope Buildbot / zopetoolkit-1.1-py2.6 slave-ubuntu64
[17]   Zope Buildbot / zopetoolkit-py2.5 slave-ubuntu32
[18]   Zope Buildbot / zopetoolkit-py2.5 slave-ubuntu64
[19]   Zope Buildbot / zopetoolkit-py2.6 slave-ubuntu32
[20]   Zope Buildbot / zopetoolkit-py2.6 slave-ubuntu64
   Zope-2.10 Python-2.4.6 : Linux
   Zope-2.11 Python-2.4.6 : Linux
   Zope-2.12 Python-2.6.6 : Linux
   Zope-2.12-alltests Python-2.6.6 : Linux
   Zope-2.13 Python-2.6.6 : Linux
   Zope-2.13-alltests Python-2.6.6 : Linux
   Zope-trunk Python-2.6.6 : Linux
   Zope-trunk-alltests Python-2.6.6 : Linux
   winbot / ZODB_dev py_265_win32
   winbot / ZODB_dev py_265_win64
   winbot / ZODB_dev py_270_win32
   winbot / ZODB_dev py_270_win64
[21]   winbot / z3c.form_py_265_32
[22]   winbot / ztk_10 py_254_win32
   winbot / ztk_10 py_265_win32
   winbot / ztk_10 py_265_win64
[23]   winbot / ztk_11 py_254_win32
   winbot / ztk_11 py_265_win32
   winbot / ztk_11 py_265_win64
   winbot / ztk_11 py_270_win32
   winbot / ztk_11 py_270_win64
   winbot / ztk_dev py_265_win32
   winbot / ztk_dev py_265_win64
   winbot / ztk_dev py_270_win32
   winbot / ztk_dev py_270_win64

Non-OK results
--

[1]FAILED  ZTK 1.0 / Python2.4.6 Linux 64bit
   https://mail.zope.org/pipermail/zope-tests/2012-January/056669.html


[2]FAILED  ZTK 1.0 / Python2.5.5 Linux 64bit
   https://mail.zope.org/pipermail/zope-tests/2012-January/056671.html


[3]FAILED  ZTK 1.0dev / Python2.4.6 Linux 64bit
   https://mail.zope.org/pipermail/zope-tests/2012-January/056679.html


[4]FAILED  ZTK 1.0dev / Python2.5.5 Linux 64bit
   https://mail.zope.org/pipermail/zope-tests/2012-January/056681.html


[5]FAILED  ZTK 1.1 / Python2.5.5 Linux 64bit
   https://mail.zope.org/pipermail/zope-tests/2012-January/056667.html


[6]FAILED  ZTK 1.1dev / Python2.5.5 Linux 64bit
   https://mail.zope.org/pipermail/zope-tests/2012-January/056678.html


[7]FAILED  Zope Buildbot / zopetoolkit-1.0-py2.4 slave-ubuntu32
   https://mail.zope.org/pipermail/zope-tests/2012-January/056699.html


[8]FAILED  Zope Buildbot / zopetoolkit-1.0-py2.4 slave-ubuntu64
   https://mail.zope.org/pipermail/zope-tests/2012-January/056689.html


[9]FAILED  Zope Buildbot / zopetoolkit-1.0-py2.5 slave-ubuntu32
   https://mail.zope.org/pipermail/zope-tests/2012-January/056701.html


[10]   FAILED  Zope Buildbot / zopetoolkit-1.0-py2.5 slave-ubuntu64
   https://mail.zope.org/pipermail/zope-tests/2012-January/056690.html


[11]   FAILED  Zope Buildbot / zopetoolkit-1.0-py2.6 slave-ubuntu32
   https://mail.zope.org/pipermail/zope-tests

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__, which seems to expect a dict now.  Override and add a
> > > raise NotImplementedError?  Or just make them work?
> > 
> > I now subclass PersistentMapping instead of SimpleVocabulary, so this is
> > not an issue anymore.
> 
> Ok.  But why Persistent?  None of the other vocabularies are
> persistent...

Yeah, using PersistentMapping was a mistake, firstly because persistence
is not necessary and secondly because it introduces a dependency on
Persistence.

> > > What's the use case for a tree vocabulary?  A widget that displays the
> > > tree structure explicitly?  
> > 
> > Yes. In my case, it's for the widget in collective.dynatree. This is a
> > fairly common use-case in Plone. Products.ATVocabularyManager also has
> > hierarchical vocabularies.
> 
> *nod*
> 
> > > It seems... difficult to extract that
> > > tree structure using just the public API.  Actually, it's impossible:
> > > __iter__ doesn't return all the terms, just top-level ones.  Am I
> > > missing something?
> > 
> > I've changed the TreeVocabulary to subclass from PersistentDict. So the
> > vocabulary itself now acts as a dict.
> 
> So is it PersistentMapping or PersistentDict then?  ;)

It was first the one, and then the other :)

> > > > 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 would just like someone to sign it off.
> > > 
> > > -1 because of the concerns above.
> > 
> > Fair enough. Have your concerns been addressed properly?
> 
> Thank you, yes.
> 
> I'm still wondering about the possibility of ordered trees.

Python 2.7 has an OrderedDict class in the collections module:
http://docs.python.org/dev/whatsnew/2.7.html#pep-0372

> And I'm -1 for subclassing PersistentMapping.  It may tempt people into
> storing tree vocabularies in the ZODB, and then maybe even modifying
> them.  And you have plenty of non-persistent dicts in the internal
> structure.
> 
> I think it would be better to subclass a regular dict, and document that
> you ITreeVocabulary is a dict-like object by making it inherit
> IEnumerableMapping.

Thanks for the suggestion, I did that.

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] 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 NotImplementedError?  Or just make them work?
> 
> I now subclass PersistentMapping instead of SimpleVocabulary, so this is
> not an issue anymore.

Ok.  But why Persistent?  None of the other vocabularies are
persistent...

> > What's the use case for a tree vocabulary?  A widget that displays the
> > tree structure explicitly?  
> 
> Yes. In my case, it's for the widget in collective.dynatree. This is a
> fairly common use-case in Plone. Products.ATVocabularyManager also has
> hierarchical vocabularies.

*nod*

> > It seems... difficult to extract that
> > tree structure using just the public API.  Actually, it's impossible:
> > __iter__ doesn't return all the terms, just top-level ones.  Am I
> > missing something?
> 
> I've changed the TreeVocabulary to subclass from PersistentDict. So the
> vocabulary itself now acts as a dict.

So is it PersistentMapping or PersistentDict then?  ;)

> > > 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 would just like someone to sign it off.
> > 
> > -1 because of the concerns above.
> 
> Fair enough. Have your concerns been addressed properly?

Thank you, yes.

I'm still wondering about the possibility of ordered trees.

And I'm -1 for subclassing PersistentMapping.  It may tempt people into
storing tree vocabularies in the ZODB, and then maybe even modifying
them.  And you have plenty of non-persistent dicts in the internal
structure.

I think it would be better to subclass a regular dict, and document that
you ITreeVocabulary is a dict-like object by making it inherit
IEnumerableMapping.

Regards,
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] zope.intid and zope.keyreference.interfaces.NotYet exception (patch)

2012-01-24 Thread Cykooz
2012/1/25 Marius Gedminas :
>
> http://foundation.zope.org/agreements is where you can find the
> committer agreement form.

Thanks.
But I have one problem. I do not know any of the existing Committer
who can vouch for me.
___
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] zope.intid and zope.keyreference.interfaces.NotYet exception (patch)

2012-01-24 Thread Marius Gedminas
On Tue, Jan 24, 2012 at 03:10:15PM +0100, Charlie Clark wrote:
> Am 23.01.2012, 23:20 Uhr, schrieb Cykooz :
> 
> >Oh ...
> >Or there is no one who is engaged in package zope.intid, or no one
> >gets an NotYet exception on the fault  this package.
> >Who can give me write access into SVN for the package zope.intid?
> 
> You must apply to the Zope Foundation for access to the repository.

http://foundation.zope.org/agreements is where you can find the
committer agreement form.

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] 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 TreeVocabulary code.
> 
> I've only glanced cursorily at the source but I'm not sure that a merge is  
> okay yet. 

Yes, Marius pointed that out as well.

> At least not all of the methods have doc strings and one of them  
> seems to have a doctest. 

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'll look into it.

> It would be nice to expand the README here.  

I don't see anything about vocabs there at all, but I'm willing to add
some tests.

> getTerm is a copy of the SimpleVocabulary method. Using the @classmethod  
> decorator is fine but inconsistent with other vocabulary classes. Using  
> the decorator is more readable so I'd suggest changing all relevant  
> methods to do that. 

Ok, I changed all the other methods to also use the decorator.

> Off the top of my head I don't know which Python  
> versions support classmethods. That should be checked in case zope.schema  
> is in a ZTK that is running on Python 2.4

Doesn't seem to be a problem for Python 2.4:
http://www.python.org/dev/peps/pep-0318/#current-syntax


> > I would just like someone to sign it off.
> > Should I rather create a ticket on launchpad? Or otherwise, should I  
> > just go ahead and merge the changes to trunk?
> 
> I would suggest going via launchpad if only because it is a better paper  
> trail. 

Ok.

> At the moment I'm still not quite sure whether this is required in  
> zope.schema. 

I think that a zope3 style TreeVocabulary is indeed needed. We use them
quite a bit in Plone (currently only for Archetypes). If not in
zope.schema, then in a separate egg?

> Do widgets only exist for z3c.form?

Well, there wasn't such a widget for z3c.form. The dynatree widget was
for Archetypes. I (and Johan Beyers) ported it to z3c.form.

Thanks for taking the time.
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] 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, 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.dynatree
> > > 
> > > And for this I needed a hierarchical tree-like vocabulary.
> > > 
> > > So I've created a TreeVocabulary in zope/schema/vocabulary.py, based
> > > upon the existing SimpleVocabulary.
> > > 
> > > Instead of fromValues or fromItems, it has fromDict, to construct the
> > > vocab from a dict. And the internal representation, self._terms, is a
> > > dictionary.
> > > 
> > > My branch is here:
> > > http://svn.zope.org/zope.schema/branches/jcbrand-treevocabulary/
> > > 
> > > The only changes are the new TreeVocabulary in zope/schema/vocabulary.py
> > > and the tests for it in zope/schema/tests/test_vocabulary.py
> > > 
> > > Can someone please take a look and give some feedback? 
> 
> vocabulary.py, line 146:
> 
>   """Initialize the vocabulary given a dict of terms.
> 
> Please clarify what a 'dict of terms' means.  AFAIC the *keys* of your
> dict are terms (instances of SimpleTerm or whatever), and the values are
> dicts representing the children.

Ok, I've clarified that a bit more.

> vocabulary.py, line 150:
> 
>   "gne or more interfaces may also be provided so that alternate"
> 
> s/gne/One/

Fixed

> test_vocabulary.py, line 223:
> 
>   self.assertTrue(dict, type(v._terms)) 
>   
> s/assertTrue/assertEqual/

Fixed.

> test_vocabulary.py, line 249:
> 
>   """ len returns the number of all nodes in die dict 
> 
> s/die/the/

Fixed.

> lines 255-257:
> 
>   self.assertTrue('Regions' in self.tree_vocab_2 and \ 
>   'Austria' in self.tree_vocab_2 and \ 
>   'Bavaria' in self.tree_vocab_2) 
> 
> The backslashes at the end of each line are not necessary.  Same on
> lines 262-264.

Removed.

> test_vocabulary, lines 192-194: you create list_vocab and items_vocab
> and then never use them.

Removed.

> 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 NotImplementedError?  Or just make them work?

I now subclass PersistentMapping instead of SimpleVocabulary, so this is
not an issue anymore.

> I think TreeVocabulary should have a corresponding interface
> ITreeVocabulary.

I agree, done.

> The new getTermPath() method is currently undocumented.

I added documentation.

> What's the use case for a tree vocabulary?  A widget that displays the
> tree structure explicitly?  

Yes. In my case, it's for the widget in collective.dynatree. This is a
fairly common use-case in Plone. Products.ATVocabularyManager also has
hierarchical vocabularies.

> It seems... difficult to extract that
> tree structure using just the public API.  Actually, it's impossible:
> __iter__ doesn't return all the terms, just top-level ones.  Am I
> missing something?

I've changed the TreeVocabulary to subclass from PersistentDict. So the
vocabulary itself now acts as a dict.

> I'm unhappy about len(tree_vocab) !+ len(list(tree_vocab)).

You're right. I fixed that.

> > 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 would just like someone to sign it off.
> 
> -1 because of the concerns above.

Fair enough. Have your concerns been addressed properly?

Thanks Marius, and Charlie, for taking the time to check the code. I
appreciate it!


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] 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: 0x4862FFF7 identi.ca & twitter: gracinet



signature.asc
Description: OpenPGP 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] zope.intid and zope.keyreference.interfaces.NotYet exception (patch)

2012-01-24 Thread Charlie Clark

Hiya,

Am 23.01.2012, 23:20 Uhr, schrieb Cykooz :


Oh ...
Or there is no one who is engaged in package zope.intid, or no one
gets an NotYet exception on the fault  this package.
Who can give me write access into SVN for the package zope.intid?


You must apply to the Zope Foundation for access to the repository.

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] 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) 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 a TreeVocabulary in zope/schema/vocabulary.py, based
> > upon the existing SimpleVocabulary.
> > 
> > Instead of fromValues or fromItems, it has fromDict, to construct the
> > vocab from a dict. And the internal representation, self._terms, is a
> > dictionary.
> > 
> > My branch is here:
> > http://svn.zope.org/zope.schema/branches/jcbrand-treevocabulary/
> > 
> > The only changes are the new TreeVocabulary in zope/schema/vocabulary.py
> > and the tests for it in zope/schema/tests/test_vocabulary.py
> > 
> > Can someone please take a look and give some feedback? 

vocabulary.py, line 146:

  """Initialize the vocabulary given a dict of terms.

Please clarify what a 'dict of terms' means.  AFAIC the *keys* of your
dict are terms (instances of SimpleTerm or whatever), and the values are
dicts representing the children.

vocabulary.py, line 150:

  "gne or more interfaces may also be provided so that alternate"

s/gne/One/

test_vocabulary.py, line 223:

  self.assertTrue(dict, type(v._terms)) 
  
s/assertTrue/assertEqual/

test_vocabulary.py, line 249:

  """ len returns the number of all nodes in die dict 

s/die/the/

lines 255-257:

  self.assertTrue('Regions' in self.tree_vocab_2 and \ 
  'Austria' in self.tree_vocab_2 and \ 
  'Bavaria' in self.tree_vocab_2) 

The backslashes at the end of each line are not necessary.  Same on
lines 262-264.

test_vocabulary, lines 192-194: you create list_vocab and items_vocab
and then never use them.

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 NotImplementedError?  Or just make them work?

I think TreeVocabulary should have a corresponding interface
ITreeVocabulary.

The new getTermPath() method is currently undocumented.

What's the use case for a tree vocabulary?  A widget that displays the
tree structure explicitly?  It seems... difficult to extract that
tree structure using just the public API.  Actually, it's impossible:
__iter__ doesn't return all the terms, just top-level ones.  Am I
missing something?

I'm unhappy about len(tree_vocab) !+ len(list(tree_vocab)).

> 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 would just like someone to sign it off.

-1 because of the concerns above.

> Should I rather create a ticket on launchpad? Or otherwise, should I
> just go ahead and merge the changes to trunk?

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] 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 is  
okay yet. At least not all of the methods have doc strings and one of them  
seems to have a doctest. It would be nice to expand the README here.  
getTerm is a copy of the SimpleVocabulary method. Using the @classmethod  
decorator is fine but inconsistent with other vocabulary classes. Using  
the decorator is more readable so I'd suggest changing all relevant  
methods to do that. Off the top of my head I don't know which Python  
versions support classmethods. That should be checked in case zope.schema  
is in a ZTK that is running on Python 2.4



I would just like someone to sign it off.
Should I rather create a ticket on launchpad? Or otherwise, should I  
just go ahead and merge the changes to trunk?


I would suggest going via launchpad if only because it is a better paper  
trail. At the moment I'm still not quite sure whether this is required in  
zope.schema. Do widgets only exist for z3c.form?


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] Undo product stops working with recent Zope (StorageTransactionError)

2012-01-24 Thread Hanno Schlichting
On Tue, Jan 24, 2012 at 2:14 PM,   wrote:
> It used to work, but with the most recent versions of
> Zope this error appears if the Undo by date is used
> more than once:

The undo API has changed with ZODB 3.10. As noted in the changelog:

"The API for undoing multiple transactions has changed. To undo
multiple transactions in a single transaction, pass a list of
transaction identifiers to a database's undoMultiple method. Calling a
database's undo method multiple times in the same transaction now
raises an exception."

Your code calls undo multiple times, and needs to be changed accordingly.

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 )


[Zope-dev] Undo product stops working with recent Zope (StorageTransactionError)

2012-01-24 Thread lists
Hi,

I have a product that patches Zope so that the Undo
screen also accepts a date and time for when to roll
back to (on pypi as Products.Undoer).

It used to work, but with the most recent versions of
Zope this error appears if the Undo by date is used
more than once:

2012-01-24 13:45:32 ERROR Zope.SiteErrorLog 1327409132.230.397033237621
http://localhost:8080/Plone/undo_changes_by_date
Traceback (innermost last):
  Module ZPublisher.Publish, line 134, in publish
  Module Zope2.App.startup, line 301, in commit
  Module transaction._manager, line 89, in commit
  Module transaction._transaction, line 329, in commit
  Module transaction._transaction, line 441, in _commitResources
  Module ZODB.DB, line 990, in tpc_begin
  Module ZEO.ClientStorage, line 1116, in tpc_begin
StorageTransactionError: Duplicate tpc_begin calls for same transaction

The code looks like this:

def undo_changes_by_date(self, date=None, REQUEST=None):
"""Undoes changes made to the database after a given date;  if
a date is not specified, all changes are undone."""
if date is None:
date = float(0)
elif type(date) == types.StringType:
date = float(DateTime(date))
else:
date = float(date)
transactions = self._p_jar.db().undoLog(0, 2**32)
undo=self._p_jar.db().undo
count = 0
for transaction in transactions:
if transaction['time'] >= date:
undo(transaction['id'])
count += 1
if REQUEST:
return MessageDialog(
title='Result of undoing transactions',
message="%s transactions were undone" % count,
action='./manage_UndoForm'
)
return count

Any ideas?  Do I need to do a tpc_begin myself?

-Morten

___
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] 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.dynatree
> 
> And for this I needed a hierarchical tree-like vocabulary.
> 
> So I've created a TreeVocabulary in zope/schema/vocabulary.py, based
> upon the existing SimpleVocabulary.
> 
> Instead of fromValues or fromItems, it has fromDict, to construct the
> vocab from a dict. And the internal representation, self._terms, is a
> dictionary.
> 
> My branch is here:
> http://svn.zope.org/zope.schema/branches/jcbrand-treevocabulary/
> 
> The only changes are the new TreeVocabulary in zope/schema/vocabulary.py
> and the tests for it in zope/schema/tests/test_vocabulary.py
> 
> Can someone please take a look and give some feedback? 

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 would just like someone to sign it off.

Should I rather create a ticket on launchpad? Or otherwise, should I
just go ahead and merge the changes to trunk?

Thanks
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 )