Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Zope: CMF

Missing Event Handler for CMFCatalogAware

 

 

Zope cmf RSS feed   Index | Next | Previous | View Threaded


charlie at begeistert

Oct 29, 2008, 6:08 AM

Post #1 of 8 (1454 views)
Permalink
Missing Event Handler for CMFCatalogAware

Hi,

I noticed in an object derived from CMFCatalogAware that it wasn't
being removed from the catalogue upon deletion. Looking at the event
handlers in CMFCatalogAware it's clear that nothing handles
IObjectWillBeRemovedEvent. Is this intentional or mereley an oversight?

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


y.2008 at wcm-solutions

Oct 29, 2008, 8:53 AM

Post #2 of 8 (1407 views)
Permalink
Re: Missing Event Handler for CMFCatalogAware [In reply to]

Charlie Clark wrote:
> I noticed in an object derived from CMFCatalogAware that it wasn't
> being removed from the catalogue upon deletion. Looking at the event
> handlers in CMFCatalogAware it's clear that nothing handles
> IObjectWillBeRemovedEvent.

I don't think so. OFS.interfaces.IObjectWillBeRemovedEvent is derived
from OFS.interfaces.IObjectWillBeMovedEvent. So these lines in
handleContentishEvent() should unindex the object:


elif IObjectWillBeMovedEvent.providedBy(event):
if event.oldParent is not None:
ob.unindexObject()


Cheers, Yuppie

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


charlie at begeistert

Nov 11, 2008, 2:26 AM

Post #3 of 8 (1376 views)
Permalink
Re: Missing Event Handler for CMFCatalogAware [In reply to]

Am 29.10.2008 um 16:53 schrieb yuppie:

> I don't think so. OFS.interfaces.IObjectWillBeRemovedEvent is derived
> from OFS.interfaces.IObjectWillBeMovedEvent. So these lines in
> handleContentishEvent() should unindex the object:
>
>
> elif IObjectWillBeMovedEvent.providedBy(event):
> if event.oldParent is not None:
> ob.unindexObject()


You are, of course, right and there is a test which tests just this
feature. Digging around I've realised that this is because I have
folderish objects which inherit from PortalFolder which explicitly
deactivates the ICMFCatalogAware methods. Is there any point in
implementing ICMFCatalogAware or IWorkflowAware for Folders? What
would we break if we removed the dependency?

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


y.2008 at wcm-solutions

Nov 11, 2008, 7:52 AM

Post #4 of 8 (1362 views)
Permalink
Re: Missing Event Handler for CMFCatalogAware [In reply to]

Hi Charlie!


Charlie Clark wrote:
> Digging around I've realised that this is because I have
> folderish objects which inherit from PortalFolder which explicitly
> deactivates the ICMFCatalogAware methods. Is there any point in
> implementing ICMFCatalogAware or IWorkflowAware for Folders? What
> would we break if we removed the dependency?

AFAICT PortalFolder inherits from CMFCatalogAware to make sure it has
the same manage_afterAdd, manage_afterClone and manage_beforeDelete
methods as other content classes. But these methods are gone, so I guess
the dependency is no longer needed.

There might be some code that expects that *all* content classes
implement ICatalogAware, IWorkflowAware and IOpaqueItemManager, but if
we add deprecation warnings the other code can be cleaned up.

In the long run I'd like to get rid of CMFCatalogAware completely. Its
functionality should be moved to adapters and event subscribers.


Cheers,

Yuppie

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


charlie at begeistert

Nov 11, 2008, 4:43 PM

Post #5 of 8 (1361 views)
Permalink
Re: Missing Event Handler for CMFCatalogAware [In reply to]

Am 11.11.2008 um 16:52 schrieb yuppie:

> AFAICT PortalFolder inherits from CMFCatalogAware to make sure it has
> the same manage_afterAdd, manage_afterClone and manage_beforeDelete
> methods as other content classes. But these methods are gone, so I
> guess
> the dependency is no longer needed.

You didn't hear it from me but this is surely abuse of inheritance?
Time to call the cops and stand outside our houses in dressing gowns
and slippers tutting and looking superior!

> There might be some code that expects that *all* content classes
> implement ICatalogAware, IWorkflowAware and IOpaqueItemManager, but if
> we add deprecation warnings the other code can be cleaned up.

+1
It's not as if Folder's behave as content although it is perfectly
reasonable in my view for Folderish objects to do so.

> In the long run I'd like to get rid of CMFCatalogAware completely. Its
> functionality should be moved to adapters and event subscribers.


Indeed.

And IWorkflowAware should be implemented separately where required, he
added quietly still working his way through Workflow code. I've
written an almost generic Transition form for IWorkflowAware objects
(the workflow should be pumped through the form). Any interest?
Currently dependent upon adding ?form.workflow_action=xyz to the
transition action which reminds me of add forms and suggests the whole
thing probably needs, ahem, revitalising.

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


y.2008 at wcm-solutions

Nov 12, 2008, 2:53 AM

Post #6 of 8 (1370 views)
Permalink
Re: Missing Event Handler for CMFCatalogAware [In reply to]

Charlie Clark wrote:
> Am 11.11.2008 um 16:52 schrieb yuppie:
>
>> AFAICT PortalFolder inherits from CMFCatalogAware to make sure it has
>> the same manage_afterAdd, manage_afterClone and manage_beforeDelete
>> methods as other content classes. But these methods are gone, so I
>> guess
>> the dependency is no longer needed.
>
> You didn't hear it from me but this is surely abuse of inheritance?
> Time to call the cops and stand outside our houses in dressing gowns
> and slippers tutting and looking superior!

This is the checkin that added CMFCatalogAware to PortalFolder:
http://svn.zope.org/?rev=35114&view=rev

It explains why and how it was done. Maybe a first step to clean this up
would be to split CMFCatalogAware into separate mixins.

Cheers, Yuppie

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


charlie at begeistert

Nov 12, 2008, 4:25 AM

Post #7 of 8 (1369 views)
Permalink
Re: Missing Event Handler for CMFCatalogAware [In reply to]

Am 12.11.2008 um 11:53 schrieb yuppie:

>
> This is the checkin that added CMFCatalogAware to PortalFolder:
> http://svn.zope.org/?rev=35114&view=rev

Wow, that's some time ago.

> It explains why and how it was done. Maybe a first step to clean
> this up
> would be to split CMFCatalogAware into separate mixins.


I'm probably missing something but nothing related to IDiscussable
seems to be in either PortalFolder or CMFCatalogAware or is that the
OpaqueItem stuff?

You're probably right to suggest that this should be a two-step
change: clean-up CMFCatalogAware; remove it from PortalFolder (it can
stay in SkinnedFolder).

Charlie
--
Charlie Clark
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-938-5360
GSM: +49-178-782-6226



_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests


tseaver at palladion

Nov 12, 2008, 5:09 AM

Post #8 of 8 (1357 views)
Permalink
Re: Missing Event Handler for CMFCatalogAware [In reply to]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Charlie Clark wrote:
> Am 12.11.2008 um 11:53 schrieb yuppie:
>
>> This is the checkin that added CMFCatalogAware to PortalFolder:
>> http://svn.zope.org/?rev=35114&view=rev
>
> Wow, that's some time ago.
>
>> It explains why and how it was done. Maybe a first step to clean
>> this up would be to split CMFCatalogAware into separate mixins.

Or take the responsibility out of the class altogether via event
subscriptions.

> I'm probably missing something but nothing related to IDiscussable
> seems to be in either PortalFolder or CMFCatalogAware or is that the
> OpaqueItem stuff?

Yes: getting the 'talkback' object's items (the comments) catalogued
was the point of the checkin.

> You're probably right to suggest that this should be a two-step
> change: clean-up CMFCatalogAware; remove it from PortalFolder (it can
> stay in SkinnedFolder).

If we made the bit about finding the opaque subitems part of the event
subscriber, then we could remove the base class from PortalFolder directly.


Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver [at] palladion
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJGtWn+gerLs4ltQ4RAgmxAJ9Oe57ZkVkRueZ4cU42Ku39Pzw0BACfRSwC
XjlE1vpczfaMzGlbj1Gsi28=
=MmON
-----END PGP SIGNATURE-----

_______________________________________________
Zope-CMF maillist - Zope-CMF [at] lists
http://mail.zope.org/mailman/listinfo/zope-cmf

See https://bugs.launchpad.net/zope-cmf/ for bug reports and feature requests

Zope cmf RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.