[Product-Developers] need help removing portlet through generic setup

Maurits van Rees m.van.rees at zestsoftware.nl
Fri Mar 30 10:40:56 UTC 2012


Op 27-03-12 11:28, Maarten Nieber schreef:
> Hi,
>
> I've been having problems configuring my portlets. According to the
> @@manage_portlets view, I have no portlets in the right column. However, Plone
> reserves an empty space on the right side of the screen for showing portlets.
>
> I installed a workaround (I hacked into the sunburst theme to not show any
> portlets in the right column) but I really need to fix this properly (I cannot
> test the patience of my client too long).
>
> I got the idea of exporting my portlets settings using the export tool. The
> result shows me that there are in fact portlets configured in the right column.
> I edited the xml to the short piece below, which I hope will remove the
> portlets.
>
> So far, I have not been succesfull, and I'm left with some questions:
>
> - the import tool lets you select the target profile. However, the export tool
> does not let you select the source profile. Does this mean that the export tool
> always exports the config that results from combining all profiles?

The export contains the current portlet configuration of your site.  It 
does not matter if the portlets have been defined in a profile or added 
by hand.

Note that I do not think that portlets on individual pages or folders 
are exported, but only at the root of the site.  The export code does 
not go through the entire site, waking up all objects to ask them if 
they have portlet assignments or portlet blocks.

See plone/app/portlets/exportimport/portlets.py to inspect the import 
and export code yourself (though that kind of code tends to be a bit 
hard to follow).

> - if this is the case, how does one know in which profile to import the modified
> configuration settings?

That does not matter.  I would expect that you have a theme or policy 
package specifically for this client.  That would be a good place to add it.

> - I added purge="False" in the root "portlets" tag (see below). Is this the
> correct way to ensure that my piece of XML does not replace the entire existing
> portlets config?

Correct.

When you add purge="True" it unregister all portlet managers and portlet 
types, and removes portlets assigned to the site root.

> - I added remove="True" to the assignment statements that (I think) assign the
> portlet to the right column. Is this the correct way to remove the assignment? I
> tried importing this into several profiles, but when I check (by exporting
> portlets.xml) the assignments are still there.

It should work (as far as I can tell without actually trying it).

You could make a deliberate typo to make the xml invalid, for example by 
simply removing the '</xml>' at the end of the file.  Now try importing 
again and see if you get an error.  If not, then you are not editing the 
correct xml file or not importing the correct profile.  Possibly a 
restart helps too, just in case; in debug (foreground) mode it should 
work fine without a restart though.


-- 
Maurits van Rees: http://maurits.vanrees.org/
Zest Software: http://zestsoftware.nl



More information about the Product-Developers mailing list