Re: [ZODB-Dev] BTrees and setdefault

2005-08-29 Thread Dmitry Vasiliev
Tim Peters wrote: [Ruslan Spivak] I'd like to implement 'setdefault' method for BTrees. For me it seems like lacking feature of mapping protocol. It can be of course easily emulated, but "Readability counts."(C) :) If there won't be objections regarding this method then i'll try to make this e

Re: [ZODB-Dev] Ordering before commit hooks

2005-08-29 Thread Julien Anguenot
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tim Peters wrote: > [Tim] > >>>... >>>It's tricky to implement this in a way that scales efficiently to >>>a "large number" of hooks. I assume that's not a problem, because >>>the current implementation doesn't scale efficiently either (it's >>>quadr

Re: [ZODB-Dev] Ordering before commit hooks

2005-08-29 Thread Julien Anguenot
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Tim Peters wrote: > [Tim] > >>... >>Julien provided links to code that already uses the new feature: >> >>""" As an Indexation Manager : >>http://svn.nuxeo.org/trac/pub/file/CPSCore/trunk/IndexationManager.py >> >>As an Event Manager : >>http://svn.nu

Re: [ZODB-Dev] Ordering before commit hooks

2005-08-29 Thread Julien Anguenot
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jim Fulton wrote: > Tim Peters wrote: > >> [Tim] >> >>> ... >>> Julien provided links to code that already uses the new feature: >>> >>> """ As an Indexation Manager : >>> http://svn.nuxeo.org/trac/pub/file/CPSCore/trunk/IndexationManager.py >>> >>> A

Re: [ZODB-Dev] Ordering before commit hooks

2005-08-29 Thread Julien Anguenot
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dieter Maurer wrote: > Tim Peters wrote at 2005-8-22 16:48 -0400: > >>... >>Jim still wonders, and he got me wondering too, whether the `order=` gimmick >>is really needed. > > > But, it is a very easy concept -- both easy to grasp as well as easy >

Re: [ZODB-Dev] Ordering before commit hooks

2005-08-29 Thread Julien Anguenot
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jim Fulton wrote: > Dieter Maurer wrote: > >> Tim Peters wrote at 2005-8-22 16:48 -0400: >> >>> ... >>> Jim still wonders, and he got me wondering too, whether the `order=` >>> gimmick >>> is really needed. >> >> >> >> But, it is a very easy concept -

[ZODB-Dev] Re: Ordering before commit hooks

2005-08-29 Thread Florent Guillaume
Just back from vacation... Jeremy Hylton wrote: On 8/22/05, Tim Peters <[EMAIL PROTECTED]> wrote: Jim still wonders, and he got me wondering too, whether the `order=` gimmick is really needed. For example, you could have gotten to the same end here with the old method, by registering your ac

Re: [ZODB-Dev] Ordering before commit hooks

2005-08-29 Thread Julien Anguenot
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jeremy Hylton wrote: > On 8/22/05, Tim Peters <[EMAIL PROTECTED]> wrote: > >>Jim still wonders, and he got me wondering too, whether the `order=` gimmick >>is really needed. For example, you could have gotten to the same end here >>with the old metho

[ZODB-Dev] Re: Setting _p_changed on a ghost

2005-08-29 Thread Florent Guillaume
Dieter Maurer wrote: Tim Peters wrote at 2005-8-26 14:59 -0400: ... Doing obj._p_changed = True when obj is a ghost appears to be senseless (what could a user possibly intend by doing this?) I met this strange behaviour and considered it a bug. What I wanted to do: use a ZODB obje

[ZODB-Dev] RE: setdefault branch

2005-08-29 Thread Tim Peters
I'm trying to straighten out the new BTree.setdefault() code, on ZODB/branches/alienoid-btrees_setdefault. Turns out this can't work like Python's dict.setdefault() in all cases. This is why: >>> d = {} >>> d.setdefault(666) >>> d {666: None} That is, the default for the optional ``default`` arg

[ZODB-Dev] RE: setdefault branch

2005-08-29 Thread Tim Peters
[Tim Peters] > ... > Proposal: make BTree/Bucket setdefault() a two-argument function (3 if > you count ``self`` too). In practice, an explicit default is always > passed, and not even in theory could we come up with a sane > default-default that works across all tree types. This has been done o

[ZODB-Dev] Re: setdefault branch

2005-08-29 Thread Ruslan Spivak
"Tim Peters" <[EMAIL PROTECTED]> writes: > I'm trying to straighten out the new BTree.setdefault() code, on > ZODB/branches/alienoid-btrees_setdefault. > > Turns out this can't work like Python's dict.setdefault() in all cases. > This is why: > d = {} d.setdefault(666) d > {666: Non

[ZODB-Dev] Re: setdefault branch

2005-08-29 Thread Ruslan Spivak
"Tim Peters" <[EMAIL PROTECTED]> writes: > [Tim Peters] >> ... >> Proposal: make BTree/Bucket setdefault() a two-argument function (3 if >> you count ``self`` too). In practice, an explicit default is always >> passed, and not even in theory could we come up with a sane >> default-default that w

RE: [ZODB-Dev] Re: setdefault branch

2005-08-29 Thread Tim Peters
[Tim] >> ... >> Nothing else to do, so in the absence of objections I'll merge this to >> ZODB trunk tomorrow. [Ruslan] > Oh, you already did that, cool! Thanks, no objections from my side :) In that case, none from my side either ;-) ___ For more info

RE: [ZODB-Dev] Re: setdefault branch

2005-08-29 Thread Tim Peters
[Tim Peters] >> I'm trying to straighten out the new BTree.setdefault() code, on >> ZODB/branches/alienoid-btrees_setdefault. >> >> Turns out this can't work like Python's dict.setdefault() in all cases. >> This is why: >> >> >>> d = {} >> >>> d.setdefault(666) >> >>> d >> {666: None} [Ruslan Spiv

[ZODB-Dev] multi-level undo on a single object

2005-08-29 Thread Arthur Peters
Hello all, I want to do the following: commit a change to an object, then commit another. Now I want to undo the second change. Easy: get the tid using undoLog and call undo(tid, transaction.get()). Now the following transactions are in the DB: - Change 1 - Change 2 - Undo change 2 Now I want t