r252542 - in collective.randomheaderimage/branches/random_image_per_section/collective/randomheaderimage: . browser

"Luca Bellenghi" <svn-changes-z4DKO/[email protected]> Mon, 16 Sep 2013 07:27:55 +0000 (UTC)
Newsgroups gmane.comp.web.zope.plone.collective.cvs
Message-ID <[email protected]>
Author: lucabel
Date: Mon Sep 16 07:27:54 2013
New Revision: 252542

Modified:
   collective.randomheaderimage/branches/random_image_per_section/collective/randomheaderimage/browser/configure.zcml
   collective.randomheaderimage/branches/random_image_per_section/collective/randomheaderimage/browser/random_image.py
   collective.randomheaderimage/branches/random_image_per_section/collective/randomheaderimage/configure.zcml
Log:
update code for logo

Modified: collective.randomheaderimage/branches/random_image_per_section/collective/randomheaderimage/browser/configure.zcml
==============================================================================
--- collective.randomheaderimage/branches/random_image_per_section/collective/randomheaderimage/browser/configure.zcml	(original)
+++ collective.randomheaderimage/branches/random_image_per_section/collective/randomheaderimage/browser/configure.zcml	Mon Sep 16 07:27:54 2013
@@ -11,15 +11,6 @@
       permission="zope.Public"
       allowed_attributes="getRandomImage"
       />
-
-  <browser:viewlet
-        name="plone.header"
-        manager="plone.app.layout.viewlets.interfaces.IPortalTop"
-        template="portal_header.pt"
-        layer=".interfaces.IRandomHeaderImageLayer"
-        permission="zope2.View"
-        />
-
   <browser:viewlet
         name="plone.logo"
         manager="plone.app.layout.viewlets.interfaces.IPortalHeader"
@@ -29,5 +20,12 @@
         permission="zope2.View"
         />
 
+  <browser:viewlet
+        name="plone.header"
+        manager="plone.app.layout.viewlets.interfaces.IPortalTop"
+        template="portal_header.pt"
+        layer=".interfaces.IRandomHeaderImageLayer"
+        permission="zope2.View"
+        />
 
 </configure>

Modified: collective.randomheaderimage/branches/random_image_per_section/collective/randomheaderimage/browser/random_image.py
==============================================================================
--- collective.randomheaderimage/branches/random_image_per_section/collective/randomheaderimage/browser/random_image.py	(original)
+++ collective.randomheaderimage/branches/random_image_per_section/collective/randomheaderimage/browser/random_image.py	Mon Sep 16 07:27:54 2013
@@ -43,7 +43,11 @@
             """
             image_folder = root.unrestrictedTraverse(images_folder_path, None)
         elif isinstance(images_folder_path, tuple):
-            mapping = self.get_mapping(images_folder_path)
+            # trivial but... if mapping is wrong return empty
+            try:
+                mapping = self.get_mapping(images_folder_path)
+            except:
+                return ""
             pcs = getMultiAdapter((self.context, self.request),
                                   name='plone_context_state')
             cpath = '/'.join(pcs.canonical_object().getPhysicalPath())

Modified: collective.randomheaderimage/branches/random_image_per_section/collective/randomheaderimage/configure.zcml
==============================================================================
--- collective.randomheaderimage/branches/random_image_per_section/collective/randomheaderimage/configure.zcml	(original)
+++ collective.randomheaderimage/branches/random_image_per_section/collective/randomheaderimage/configure.zcml	Mon Sep 16 07:27:54 2013
@@ -4,8 +4,7 @@
     xmlns:cmf="http://namespaces.zope.org/cmf"
     i18n_domain="collcetive.randomheaderimage">
 
-   <include package=".browser" />
-
+   <include package=".browser"/>
    <include file="profiles.zcml" />
 
 </configure>

------------------------------------------------------------------------------
LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99!
1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint
2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes
Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. 
http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk