OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) OpenSprinkler Interval Program now available for OSPi! Re: Re: OpenSprinkler Interval Program now available for OSPi!

#24450

Andrew
Participant

The favicon will be because it has been added to the html of the first page and has been missed on the others.

Personally I’d prefer to use a redirect in to the static file whenever it is requested. A couple of reasons:

  • It’s done once and works everywhere (avoiding this potentially).
  • The returned html is smaller and faster. (not a big deal but does help people connecting over the Internet or a VPN)
  • The favicon query is only processed and sent on the rarer occasions that the browser asks for it.
  • The favicon is not requested by any of the new frontends being created.

None of this is a big deal, just optimisation. It applies to the apple-touch-icon-precomposed.png too if you want one of these to make a bookmark on an iPhone/iPad.

Dan may have some reasons against this approach though and I’m not a real Python programmer so take that into account with my approach. I do live and work around bandwidth constrained environments though where sometimes little things like this can make a difference.

If you want to have it everywhere either copy the favicon line from the html on the first page to each of the other html generation code or add the following to the urls (near the top of ospi.py):

    '/favicon.ico', 'favicon',
'/apple-touch-icon-precomposed.png', 'appleicon',

and then this to the bottom of the script:

class favicon:
"""redirect to /static/images/icons/favicon.ico"""
def GET(self):
raise web.seeother('/static/images/icons/favicon.ico')
return

class appleicon:
"""redirect to /static/images/icons/apple-touch-icon-precomposed.png"""
def GET(self):
raise web.seeother('/static/images/icons/apple-touch-icon-precomposed.png')
return