Custom version of composer (IFullFormatter), adapter to override plone_html_strip_not_likey

0 views
Skip to first unread message

David Bain

unread,
Nov 15, 2009, 5:34:41 PM11/15/09
to singing...@googlegroups.com
My goal is to override "plone_html_strip_not_likey" using an addon
product, from what I'm seeing the key thing to adapt is
PloneCallHTMLFormatter

This is the registration of the PloneCallHTMLFormatter (as far as I can see)

<adapter factory=".composer.PloneCallHTMLFormatter"
for="Products.CMFCore.interfaces.IContentish
zope.publisher.interfaces.browser.IBrowserRequest"
provides=".interfaces.IFullFormatter"
name="html" />

If I add a similar registration in an add-on product will it override that one?

<adapter factory="my.product.composer.PloneCallHTMLFormatter"
for="Products.CMFCore.interfaces.IContentish
zope.publisher.interfaces.browser.IBrowserRequest"
provides="collective.dancing.interfaces.IFullFormatter"
name="html" />

Is there anything else I need to bear in mind?
--
SplashStart - Professional Websites. Starting Now.
http://www.splashstart.com

David Bain

unread,
Nov 16, 2009, 10:01:33 AM11/16/09
to singing...@googlegroups.com
Update:
so far I've found that I needed to adapt a class instead of an interface:

So this is what I'm doing:

<adapter factory="collective.splashdancing.mycomposer.PloneCallHTMLFormatter"
for="Products.ATContentTypes.content.base.ATCTContent


zope.publisher.interfaces.browser.IBrowserRequest"
provides="collective.dancing.interfaces.IFullFormatter"
name="html" />

will update on how this works.

David Bain

unread,
Nov 16, 2009, 10:08:21 AM11/16/09
to singing...@googlegroups.com
Okay... works very nicely with the class. Of course I'm limited to
ATCTContent types because of the class I'm using, but that's fine as
dexterity based content won't be in my newsletters for now.

Could someone tell me why sometimes interfaces don't work when
registering an adapter with ZCML?

Daniel Nouri

unread,
Nov 17, 2009, 4:21:42 AM11/17/09
to singing...@googlegroups.com, David Bain
On Mon, Nov 16, 2009 at 4:08 PM, David Bain <david...@alteroo.com> wrote:
>
> Okay... works very nicely with the class. Of course I'm limited to
> ATCTContent types because of the class I'm using, but that's fine as
> dexterity based content won't be in my newsletters for now.
>
> Could someone tell me why sometimes interfaces don't work when
> registering an adapter with ZCML?

You can't register two adapters for exactly the same interface(s).
This way the ZCA doesn't know which one of the implementations to use
or prefer. Use overrides.zcml replace the registration of the
implementation that's in dancing.

BTW, have you checked if changing
collective.dancing.composer.plone_html_strip_not_likey in place isn't
enough?

Daniel

David Bain

unread,
Nov 17, 2009, 1:28:03 PM11/17/09
to Daniel Nouri, singing...@googlegroups.com
My goal was to create a plugin that would allow through the web editting of "banned" ids and classes
In the long run, I believe that  we should make it so a designer (css dude type) should be able to tweak a s&d newsletter,
completely through a control panel.

While editing collective.dancing.composer.plone_html_strip_not_likey does work,
it required too much knowledge of the system and therefore wasn't "css-dude friendly".
I thought it was a bit nasty to have to dig into an egg and "dirty" my hands each time I wanted to zap an id or class.

The result of all of this is that I've extended my little singing and dancing add-on project collective.splashdancing (http://pypi.python.org/pypi/collective.splashdancing), it supports id and class zapping TTW.

The features include:
--------------------------------
- pictures sent with news items
- A control panel for "zapping" HTML ids and classes that should not show up in newsletters

http://img.skitch.com/20091117-m9ixk22445bi8nwxbg7biprsqm.jpg
Reply all
Reply to author
Forward
0 new messages