#228 — Translation links break when using Virtual Host Monster and folders as default page view items at portal root

by Mykhailo Makukha last modified Jul 28, 2010 10:37 PM
State Resolved
Version: 3.x
Area Functionality
Issue type Bug
Severity Medium
Submitted by Mykhailo Makukha
Submitted on Dec 22, 2009
Responsible
Target release: 3.x
LinguaPlone version: 3.0.
Environment: Plone 3.3.2, CMF 2.1.2, Zope 2.10.7-final, Python 2.4.5.

The problem with LinguaPlone language selector links, when the Plone site is behind behind Apache and Virtual Host Monster, was previously reported by Hanno Schlichting (bug #216, http://plone.org/products/linguaplone/issues/216): language selector ("flags") link urls contained ".../VirtualHostBase/http/...".

The bug was reported as fixed in version 3.0.b8, but in some circumstances it appears in version 3.0, namely when a folder is used as a default page view item for the portal root, and the default page view item for that folder is also selected. When the default page view item for the portal root is a page, language selector links work fine.
Steps to reproduce:
0. Create Plone site with LinguaPlone (my versions were Plone 3.3.2 and LinguaPlone 3.0) with two or more portal languages selected - let them be English and Russian. Create Apache redirect to the site through the VirtualHostBase.
1. At the portal root create the folder '/en' in English and translate it into folder '/ru' in Russian.
2. In folder '/en' create som page 'test' in English and translate it into '/ru/test' in Russian.
3. Make '/en/test' be a default page view item for the folder '/en', and make '/ru/test' a default page for '/ru'.
4. Make 'Folder' content type available to be selected as a default page view item: add 'Folder' line to default_page_types lines field at /portal_properties/site properties through the ZMI.
5. Make '/en' folder be a default page view item for the portal root.

Now, when you view the portal root, language selector link urls will contain VHM stuff like '.../VirtualHostBase/http/...' and, naturally, won't work. When you go to some page at the portal, links will become correct.
Added by Mykhailo Makukha on Jan 21, 2010 10:19 PM
The problem was actually not in default view, but in the Virtual Host Monster path elements and the way LinguaPlone 3.0 tries to ignore them. It ignores '/VirtualHostRoot/' but not '/VirtualHostBase/.../.../'.
Added by Mykhailo Makukha on Jan 21, 2010 10:47 PM
Here's a patch I used:
83a84,87
> if 'VirtualHostBase' in current_path:
> while current_path[-1] != 'VirtualHostBase':
> current_path.pop()
> current_path.pop() # remove 'VirtualHostBase' itself
Added by Mykhailo Makukha on Jan 21, 2010 10:52 PM
Whitespaces disappeared. One more attempt. Initial underscores should be replaced with spaces.
83a84,87
>_________________if 'VirtualHostBase' in current_path:
>_____________________while current_path[-1] != 'VirtualHostBase':
>_________________________current_path.pop()
>_____________________current_path.pop() # remove 'VirtualHostBase' itself
The file to be patched is Products.LinguaPlone/Products/LinguaPlone/browser/selector.py
Added by Florian Friesdorf on Apr 08, 2010 06:23 PM
A possible fix might also be:

https://dev.plone.org/[…]/Products?rev=35880
Added by Florian Friesdorf on Apr 08, 2010 06:25 PM
and, yes - I can confirm the bug for a site where folders were enabled as default view of other folders and it feels there needs to be a '4' in case one carries on the idea...

I currently don't have an opinion whether folders as default views of folders are good or bad, but it seems to be possible to set it up.
Added by Hanno Schlichting on Jul 28, 2010 10:37 PM
Issue state: UnconfirmedResolved
Target release: None3.x
This should be fixed since 3.1a4.

No responses can be added.