From 03a314ccc79e606029dd0a8ae6305c15b171bb65 Mon Sep 17 00:00:00 2001
From: Tristan Cavelier <tristan.cavelier@nexedi.com>
Date: Mon, 4 Jan 2016 04:09:25 -0500
Subject: [PATCH] erp5_knowledge_pad: ERP5Site_viewRandomPageGadget: prevent
 fail if no box is provided

(from Rafaels' changes)
---
 .../erp5_gadget/ERP5Site_viewRandomPageGadget.xml          | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_gadget/ERP5Site_viewRandomPageGadget.xml b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_gadget/ERP5Site_viewRandomPageGadget.xml
index 3eb018f63f..20f84eccb6 100644
--- a/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_gadget/ERP5Site_viewRandomPageGadget.xml
+++ b/bt5/erp5_knowledge_pad/SkinTemplateItem/portal_skins/erp5_gadget/ERP5Site_viewRandomPageGadget.xml
@@ -79,7 +79,12 @@ if box_relative_url:\n
 # Get the preferences (some casting of preferences would \n
 # probably be a good thing here so that there is no need\n
 # to cas them later)\n
-preferences = box.KnowledgeBox_getDefaultPreferencesDict()\n
+# \n
+# Prevent fail if no box is provided. \n
+if box is not None:\n
+  preferences = box.KnowledgeBox_getDefaultPreferencesDict()\n
+else:\n
+  preferences = {}\n
 \n
 if web_section_url is None:\n
   web_section_url = preferences.get(\'web_section_url\', \'\') # XXX-JPS - Why do we have to do casting ? (used to be str()\n
-- 
2.30.9