[Grok-dev] NotFound: Object: <zope.site.folder.Folder object at 0x#######>, name: u'favicon.ico'
Hector Blanco
white.lists at gmail.com
Mon Dec 13 14:38:18 EST 2010
It works... well I still don't know if it's really serving the icon or
not, but at least it doesn't complain :)
2010/12/11 Jan-Jaap Driessen <jdriessen at thehealthagency.com>:
> On 10 December 2010 22:47, Hector Blanco <white.lists at gmail.com> wrote:
>> Hello everyone!
>>
>> I have a problem that is not too serious but that has been bothering
>> me a little...
>>
>> When I request a page from my Grok server (in debug mode), I get an exception
>> Debug at: http://127.0.0.1:8080/_debug/view/1292017221
>>
>> And it's because it doesn't find the favicon.ico:
>>
>> URL: http://127.0.0.1:8080/favicon.ico
>> Module paste.evalexception.middleware:306 in respond
>> [ . . . stuff, stuff, stuff . . .]
>> NotFound: Object: <zope.site.folder.Folder object at 0x976476c>, name:
>> u'favicon.ico'
>>
>> But sometimes, when I'm developing something new, it scares the s**t
>> out of me (I think I've done a bad mistake). I wouldn't mind providing
>> a sample (even empty) icon so it would find it and it won't complain
>> anymore, but I don't know where to place it.
>>
>> Thank you in advance!
>
> Hi Hector,
>
> You can register a response for favicon.ico like this (pseudo-code, not tested):
>
> '''
> from pkg_resources import resource_stream
>
> from zope.interface import Interface
> import grok
>
> class Favicon(grok.View):
> grok.context(Interface)
> grok.name('favicon.ico')
>
> def render(self):
> self.request.response.setHeader('Content-Type',
> 'image/vnd.microsoft.icon')
> return resource_stream('mypackage', 'path/to/favicon.ico')
> '''
>
> HTH,
>
> --
> Jan-Jaap Driessen
>
More information about the Grok-dev
mailing list