Skip to content

Commit

Permalink
2375 fix favicon pain for 500 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed May 30, 2012
1 parent e2a0066 commit d1a73f8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ckan/config/environment.py
Expand Up @@ -142,6 +142,10 @@ def find_controller(self, controller):
'ckan.site_id for SOLR search-index rebuild to work.'
config['ckan.site_id'] = ckan_host

# ensure that a favicon has been set
favicon = config.get('ckan.favicon', '/images/icons/ckan.ico')
config['ckan.favicon'] = favicon

# Init SOLR settings and check if the schema is compatible
#from ckan.lib.search import SolrSettings, check_solr_schema_version
search.SolrSettings.init(config.get('solr_url'),
Expand Down
3 changes: 3 additions & 0 deletions ckan/config/routing.py
Expand Up @@ -316,6 +316,9 @@ def make_map():
for plugin in routing_plugins:
map = plugin.after_map(map)

# sometimes we get requests for favicon.ico we should redirect to
# the real favicon location.
map.redirect('/favicon.ico', config.get('ckan.favicon'))

map.redirect('/*(url)/', '/{url}',
_redirect_code='301 Moved Permanently')
Expand Down
2 changes: 1 addition & 1 deletion ckan/templates/base.html
Expand Up @@ -12,7 +12,7 @@
<title py:with="title = list(select('title/text()'))">
<py:if test="title">${title} - </py:if>CKAN
</title>
<link rel="shortcut icon" href="/base/images/ckan.ico" />
<link rel="shortcut icon" href="${config.get('ckan.favicon')}" />
<link rel="stylesheet/less" href="/base/less/main.less" />
<script src="/base/test/vendor/less.js"></script>
${select('*[local-name()!="title"]')}
Expand Down

0 comments on commit d1a73f8

Please sign in to comment.