#216 — Translation links break when using Virtual Host Monster
by
Marlon Richert
—
last modified
Mar 02, 2010 04:30 PM
| State | Resolved |
|---|---|
| Version: |
—
|
| Area | Functionality |
| Issue type | Bug |
| Severity | Medium |
| Submitted by | Marlon Richert |
| Submitted on | Sep 28, 2009 |
| Responsible |
—
|
| Target release: | 3.x |
VERSION: LinguaPlone 3.0b3 with Plone 3.3.1. (LinguaPlone 3.0a3 with Plone 3.3, too.)
DESCRIPTION: When using Virtual Host Monster with VirtualHostRoot, URLs in language flags are broken.
WORKAROUND: Replacing the contents of Products.LinguaPlone.browser/selector.pt with those of plone.app.i18n.locales.browser/languageselector.pt seems to work.
DESCRIPTION: When using Virtual Host Monster with VirtualHostRoot, URLs in language flags are broken.
WORKAROUND: Replacing the contents of Products.LinguaPlone.browser/selector.pt with those of plone.app.i18n.locales.browser/languageselector.pt seems to work.
- Steps to reproduce:
- 0. Plone is running on port 8080 behind Apache running on port 80. LinguaPlone is installed and one or more languages other than the default have been selected in "Allowed languages" in portal_language.
1. Set up a DNS entry for domainname and use Apache to rewrite "/(.*)" to http://localhost:8080/[…]/$1
2. Go to http://domainname/ (or any page there).
3. Links in language flags are of the broken form http://domainname/VirtualHostRoot?set_language=xx&-C=
Added by
Marlon Richert
on
Oct 02, 2009 07:33 AM
The workaround above seems to break some things. Here's a better one:Undo the above workaround and instead create a new theme add-on product with the following in the browser/ folder:
selector.py:
from Products.LinguaPlone.browser.selector import TranslatableLanguageSelector
class LanguageSelector(TranslatableLanguageSelector):
def languages(self):
results = TranslatableLanguageSelector.languages(self)
for data in results:
data['url'] = data['url'].replace('VirtualHostRoot', 'switchLanguage').replace('&-C=', '')
return results
configure.zcml:
...
<browser:viewlet name="plone.app.i18n.locales.languageselector"
manager="plone.app.layout.viewlets.interfaces.IPortalTop"
class=".selector.LanguageSelector"
permission="zope2.View" layer=".interfaces.IThemeSpecific" />
...
Added by
Hanno Schlichting
on
Oct 02, 2009 05:46 PM
I suspect we have a problem with the new code preserving the query string arguments here.
Issue state:
Unconfirmed
→
Confirmed
Could you try to see what the line:
"current_path = filter(None, self.request.get('PATH_INFO', '').split('/'))"
inside the languages method of LP's selector contains for you? And maybe how this is altered in the following logic?
Both a couple of print statements or a pdb session would help quite a bit to understand the issue here.
Added by
Marlon Richert
on
Oct 05, 2009 09:08 AM
Here's a pdb session with a couple of "p" statements (see attachment). From the debugger, it seems that the "VirtualHostRoot" problem only occurs when the URL passed by Apache *ends* in "VirtualHostRoot", that is, in the site root. For example,(Pdb) p current_path
['VirtualHostBase', 'http', 'example.com:80', 'Plone', 'VirtualHostRoot']
results in the broken
(Pdb) p state.view_url() + appendtourl
'http://example.com/VirtualHostRoot?set_language=en&-C='
but
(Pdb) p current_path
['VirtualHostBase', 'https', 'example.com:443', 'Plone', 'VirtualHostRoot', 'news']
results in
(Pdb) p state.view_url() + appendtourl
'https://example.com/news?set_language=en&-C='
Don't know what that empty "-C" form variable is doing there. Would you happen to have any idea what it's for or where it comes from? It didn't use to be there earlier and I'm not passing it myself.
Added by
Hanno Schlichting
on
Oct 22, 2009 06:23 PM
Ok. I fixed this in SVN. It will be released as part of 3.0b8.
Issue state:
Confirmed
→
Resolved
Target release:
None
→
3.x
Added by
Victor Fernandez de Alba
on
Mar 02, 2010 04:30 PM
Sorry to bother you, but this problem has not been solved... At least on the root site. Tried on Plone 3.3.4, LinguaPlone 3.0c4, 3.0.1 and 3.1b1 and it's still there.The problem is that when doing the virtualhosting (in Apache),the language links at root get wrong: e.g. www.foo.bar/_vh_blabla?set_language=es
On other levels it works fine...
Víctor.
No responses can be added.
If you can, please log in before submitting a reaction.

