[Zope-CMF] Re: SVN: CookieCrumbler
Florent Guillaume
fg at nuxeo.com
Tue Jan 31 18:49:23 EST 2006
Tres Seaver wrote:
> Log message for revision 41514:
> @@ -395,7 +383,24 @@
>
> Globals.InitializeClass(CookieCrumbler)
>
> +def handleCookieCrumblerEvent(ob, event):
> + """ Event subscriber for (un)registering a CC as a before traverse hook.
> + """
> + if not ICookieCrumbler.providedBy(ob):
> + return
>
> + if IObjectMovedEvent.providedBy(event):
> + if event.newParent is not None:
> + # register before traverse hook
> + handle = ob.meta_type + '/' + ob.getId()
> + nc = BeforeTraverse.NameCaller(ob.getId())
> + BeforeTraverse.registerBeforeTraverse(event.newParent, nc, handle)
> + elif IObjectWillBeMovedEvent.providedBy(event):
> + if event.oldParent is not None:
> + # unregister before traverse hook
> + handle = ob.meta_type + '/' + ob.getId()
> + BeforeTraverse.unregisterBeforeTraverse(event.newParent, handle)
I think you want event.oldParent here.
Florent
> +
> class ResponseCleanup:
> def __init__(self, resp):
> self.resp = resp
--
Florent Guillaume, Nuxeo (Paris, France) Director of R&D
+33 1 40 33 71 59 http://nuxeo.com fg at nuxeo.com
More information about the Zope-CMF
mailing list