--- a/src/pyams_skin/configuration.py Wed May 20 12:37:16 2015 +0200
+++ b/src/pyams_skin/configuration.py Wed May 20 15:01:45 2015 +0200
@@ -9,7 +9,6 @@
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
-from pyams_file.property import FileProperty
__docformat__ = 'restructuredtext'
@@ -26,9 +25,13 @@
# import packages
from persistent import Persistent
+from pyams_file.property import FileProperty
+from pyams_file.views.file import ImageView
from pyams_utils.adapter import ContextRequestViewAdapter, ContextAdapter, adapter_config
from pyams_utils.request import check_request
from pyams_utils.traversing import get_parent
+from pyramid.httpexceptions import HTTPNotFound
+from pyramid.view import view_config
from zope.container.contained import Contained
from zope.interface import implementer, Interface
from zope.location.location import locate
@@ -127,3 +130,13 @@
def traverse(self, name, furtherpath=None):
return IConfiguration(self.context)
+
+
+@view_config(name='favicon.ico', context=IConfigurationManager)
+def site_icon(request):
+ configuration = IConfiguration(request.context)
+ if configuration.icon is not None:
+ request = request.copy()
+ request.context = configuration.icon
+ return ImageView(request)
+ return HTTPNotFound()