How do I debug why a viewlet is not being hidden even after adding it to viewlets.xml?

I've added a viewlet do be hidden in viewlets.xml in an upgradeStep and executed portal_setup but it's not working since the viewlet it's still being rendered (even using skinname="*" in the xml). Here's is what I did to see if the xml file was correctly imported:

  • I added ? in my url, to be certain that Diazo isn't mangling stuff, but the viewlet is still rendered;
  • I exported viewlets.xml from portal_setup and the viewlet is shown there as "hidden" but it's still being rendered.

I would like to know what else can I do to debug it to try to find what the hell is going on. Just for the sake of example, I'm trying to hide in my.package a viewlet that is registered in collective.package.

1 Like
  1. Do you have the hidden viewlet listed in the correct manager? Does it appear in more than one manager? Also providing your viewlets.xml would be helpful.
  2. Why not <drop /> the viewlet with Diazo?
  1. Yes, in the correct manager. No, it doesn't appear in more than one manager.
  2. I don't like this approach when there's already the hidden machinery in place, and our Diazo rules are in a second package.

But somehow your post gave my an idea: the viewlet is in, but there isn't a viewlets.xml in the package profile (, only the zcml directive. How can I hide it using only zcml, create a new class and override it making render method return ''?

So, it seems that you can only try to use hidden for a viewlet in viewlets.xml if it was prior registered in another viewlets.xml. Can anyone confirm this? Indeed this is what makes sense, I was only dreaming that if the xml did nothing a warning would have been nice.

seems to me you can't hide the viewlet because is bounded to the view in ZCML (check the view directive below):

what's exactly what do you want to achieve? that package provides a view with no viewlet registered (text_only_view). customizes collective.nitf and we're upgrading from 1.x to 2.x there, but that big image in articles isn't expected in IDGB layout, so it needs to be hidden.

We can't use TextOnlyView because we need the get_images method that is only at View.

Anyways, since you didn't give a layer, the simplest way was to customize the viewlet adding an empty template with our layer.

why can't you just remove it instead of hiding it ?

have you tried overriding it using another browser layer?

I guess you can also use overrides.zcml in the context of your policy package.

This is a very specific case, we have a package named that customized a browser view in collective.nitf 1.x. will use collective.nitf 2.x, and that customized view now has an associated viewlet that isn't expected in the layout standards of, so we need to hide it, and couldn't do it using viewlets.xml. We just don't know if it doesn't work because of what we think is the problem or what @hvelarde says.

This is not a problem with collective.nitf that it's going fine, it's with our package and our specific customization.

@hvelarde the solution for hiding can be achieved using overrides.zcml (which we think is overkill) but since you don't ask for collective.nitf's layer in your viewlet zcml registration we can just override it by putting in our zcml with our layer and an empty template.

We already know alternative ways to acomplish the task of hiding it, the motivation of this post is just to try to understand why viewlets.xml with hidden doesn't work in specific cases.