From 418735d75a2371176624cc0c5a3fd256dbd1d494 Mon Sep 17 00:00:00 2001
From: Gabriel Monnerat <gabriel@tiolive.com>
Date: Mon, 4 Feb 2013 14:10:44 +0100
Subject: [PATCH] Extend code to remove the language from real context url is
 exist

---
 .../ERP5Site_getActiveKnowledgePadForUser.xml              | 7 ++++++-
 bt5/erp5_knowledge_pad/bt/revision                         | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/ERP5Site_getActiveKnowledgePadForUser.xml b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/ERP5Site_getActiveKnowledgePadForUser.xml
index ac4ad49aad..463e05474a 100644
--- a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/ERP5Site_getActiveKnowledgePadForUser.xml
+++ b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_knowledge_pad/ERP5Site_getActiveKnowledgePadForUser.xml
@@ -75,6 +75,11 @@ while real_context.isTempObject():\n
   real_context = real_context.getParentValue()\n
 real_context_url = real_context.getRelativeUrl()\n
 \n
+real_context_url_list = real_context_url.split("/")\n
+current_language = context.Localizer.get_selected_language()\n
+if current_language in real_context_url_list:\n
+  real_context_url = "/".join(filter(lambda x: x != current_language, real_context_url_list))\n
+\n
 # first filter if we have a custom Pad for the context\n
 for knowledge_pad in knowledge_pads:\n
   pad_state = knowledge_pad.getValidationState()\n
@@ -88,7 +93,7 @@ for knowledge_pad in knowledge_pads:\n
       return knowledge_pad, knowledge_pads\n
   elif len(publication_section_list) == 0 and default_pad_group in MARKER and pad_state in visible_state_list:\n
     # ERP5 Site front gadget \n
-    return knowledge_pad, knowledge_pads    \n
+    return knowledge_pad, knowledge_pads\n
 \n
 # no customized version found for this context so\n
 # try finding pad by group\n
diff --git a/bt5/erp5_knowledge_pad/bt/revision b/bt5/erp5_knowledge_pad/bt/revision
index 880ae56552..d7a801b1e0 100644
--- a/bt5/erp5_knowledge_pad/bt/revision
+++ b/bt5/erp5_knowledge_pad/bt/revision
@@ -1 +1 @@
-756
\ No newline at end of file
+757
\ No newline at end of file
-- 
2.30.9