Folder contents and Navigation box disappears after calling setLanguage

5 Messages Forum Options Options
Permalink
Jean Jordaan
Folder contents and Navigation box disappears after calling setLanguage
Reply Threaded More
Print post
Permalink
Hi all

I could use a sanity check here. I have a site with a bunch of
content, with no language set. I run a small script to set all of it
to a particular language.
Subsequently the Folder contents and Navigation box appears empty,
though the content is still there and can be browsed via the ZMI, from
where the View action shows the Plone view of the object which looks
fine.

Here is the script:

"""
## Script (Python) "fix__set_language"
##parameters=d=0, c=None
##
if not c:
 c = context
contents = c.contentValues()
for o in contents:
 context.REQUEST.RESPONSE.write( '%ssetting: %s\n'%(' '*d, o.getId()) )
 o.setLanguage('en')
 if o.isPrincipiaFolderish:
   context.REQUEST.RESPONSE.write( '%sdiving into: %s\n'%(' '*d, o.getId()) )
   context.fix__set_language(d+2,o)
"""

I can query the catalog for document ids, but this simple query:
 results = context.portal_catalog.searchResults(portal_type=['Document'])
returns results before I run the script, but not after.

When I click on the flag corresponding to the language set in the
script, the content reappears.

If I select more than one language (e.g. English and Portuguese via
Language Setting in Plone) the navigation tree does not show.

All this is with LinguaPlone 1.1 and Plone 2.5.x.

I partly suspect LinguaPlone is working as intended .. I just want to
check what behaviour I'm supposed to be seeing.

--
jean . .. .... //\\\oo///\\

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Plone-i18n mailing list
Plone-i18n@...
https://lists.sourceforge.net/lists/listinfo/plone-i18n
grahamperrin-ac.uk
Re: Folder contents and Navigation box disappears after calling setLanguage
Reply Threaded More
Print post
Permalink
Jean Jordaan wrote:
… the Folder contents and Navigation box appears empty, though the content is still there and can be browsed via the ZMI …
Reminds me of
<http://www.nabble.com/Content-View-Disappears-on-3.1.1-Migration-and-LP-Reinstall-td17404998s6748.html> and of the 'content becomes invisible' aspect of http://plone.org/products/linguaplone/issues/168>.
Jean Jordaan
Re: Folder contents and Navigation box disappears after calling setLanguage
Reply Threaded More
Print post
Permalink
Hi there

I'm pretty sure I just need to understand LinguaPlone language
negotiation and Plone caching better.
Here's a run I just did:

- View content, all fine.
- Run script -- navigation box/folder contents gone.
- Switch browser language to Spanish, add Spanish to list of allowed
languages in site setup -- still nothing.
- Restart Zope, uninstall/reinstall LinguaPlone -- still nothing.
- Manually browse to .../front-page: voila, navigation box/folder
contents reappears.
- Continue browsing -- navigation box/folder contents are fine.

In summary:
- I don't think the script breaks anything as far as the content is concerned.
- After running the script, my initial page requests were for the
original language, not the new one. Plone rendered and cached the
empty views.
- Plone doesn't notice that I updated my language settings, so
subsequent views of the site render the cached versions of the
navigation/contents views. These are expensive to calculate, so it
makes sense to cache them.
- When I browse to an uncached place, the views get a kick and are recalculated.

If anyone would like to reproduce and confirm this using the script I
posted, I'd be very grateful.

Also, I'd like to know your opinions on how this could be addressed ..
is it a bug? A usability issue corner case? I suspect it will only
affect admin users who actually need to run a script like the one I
posted, and that new users with properly configured browsers/site
preferences will  see the content that they should see. Though I also
suspect that if a user were unlucky enough to be browsing the site
during the update may also hit the cached views, until they restart
their browsers.

--
jean                     . .. .... //\\\oo///\\

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Plone-i18n mailing list
Plone-i18n@...
https://lists.sourceforge.net/lists/listinfo/plone-i18n
Maurits van Rees-3
Re: Folder contents and Navigation box disappears after calling setLanguage
Reply Threaded More
Print post
Permalink
Jean Jordaan, on 2008-05-26:

> In summary:
> - I don't think the script breaks anything as far as the content is concerned.
> - After running the script, my initial page requests were for the
> original language, not the new one. Plone rendered and cached the
> empty views.
> - Plone doesn't notice that I updated my language settings, so
> subsequent views of the site render the cached versions of the
> navigation/contents views. These are expensive to calculate, so it
> makes sense to cache them.
> - When I browse to an uncached place, the views get a kick and are recalculated.

I think the point here is that you somehow need to use the language
selection portlet/viewlet/macro from LinguaPlone instead of the
default one from Plone itself.  On Plone 3.1.1 this is done
automatically with the use of plone.browserlayer.  I am not sure what
the procedure on Plone 2.5 is.

IIRC the default Plone language selection just changes the browser
language and the linguaplone one also changes the content language so
you are redirected to e.g. the Spanish version of the page you are now
looking at.  When that content language change is not done, Plone
looks in the current English folder, sees that there is no Spanish
content and does not show anything.

--
Maurits van Rees | http://maurits.vanrees.org/
            Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Plone-i18n mailing list
Plone-i18n@...
https://lists.sourceforge.net/lists/listinfo/plone-i18n
Jean Jordaan
Re: Folder contents and Navigation box disappears after calling setLanguage
Reply Threaded More
Print post
Permalink
Hi Maurits

> I think the point here is that you somehow need to use the language
> selection portlet/viewlet/macro from LinguaPlone instead of the
> default one from Plone itself.

Ah. I would have thought this happens automatically as well thanks to
overrides in Products/LinguaPlone/skins/LinguaPlone.
I'll try putting debugging slugs in the *.pt files there to see
whether they're the ones that get used.

> When that content language change is not done, Plone
> looks in the current English folder, sees that there is no Spanish
> content and does not show anything.

Hmm, how does that fit with content beginning to show up in the folder
view after visiting a page?
Surely it should keep on seeing that there is no Spanish content etc.

--
jean                   . .. .... //\\\oo///\\

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Plone-i18n mailing list
Plone-i18n@...
https://lists.sourceforge.net/lists/listinfo/plone-i18n