Hi,<br><br>With the code given by Jan-Jaap, if you try to access to favicon.ico, you get:<br><b>TypeError: The result should be None, a string, or adaptable to IResult.<br></b><br>Simply add read() and it works fine. I can see the favicon in the url bar.<br>
return resource_stream('dolmenexample', 'favicon.ico').read()<br><br>Happy new year!<br><br clear="all">Vincent<br>
<br><br><div class="gmail_quote">On Mon, Dec 13, 2010 at 8:38 PM, Hector Blanco <span dir="ltr"><<a href="mailto:white.lists@gmail.com">white.lists@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
It works... well I still don't know if it's really serving the icon or<br>
not, but at least it doesn't complain :)<br>
<br>
2010/12/11 Jan-Jaap Driessen <<a href="mailto:jdriessen@thehealthagency.com">jdriessen@thehealthagency.com</a>>:<br>
<div><div></div><div class="h5">> On 10 December 2010 22:47, Hector Blanco <<a href="mailto:white.lists@gmail.com">white.lists@gmail.com</a>> wrote:<br>
>> Hello everyone!<br>
>><br>
>> I have a problem that is not too serious but that has been bothering<br>
>> me a little...<br>
>><br>
>> When I request a page from my Grok server (in debug mode), I get an exception<br>
>> Debug at: <a href="http://127.0.0.1:8080/_debug/view/1292017221" target="_blank">http://127.0.0.1:8080/_debug/view/1292017221</a><br>
>><br>
>> And it's because it doesn't find the favicon.ico:<br>
>><br>
>> URL: <a href="http://127.0.0.1:8080/favicon.ico" target="_blank">http://127.0.0.1:8080/favicon.ico</a><br>
>> Module paste.evalexception.middleware:306 in respond<br>
>> [ . . . stuff, stuff, stuff . . .]<br>
>> NotFound: Object: <zope.site.folder.Folder object at 0x976476c>, name:<br>
>> u'favicon.ico'<br>
>><br>
>> But sometimes, when I'm developing something new, it scares the s**t<br>
>> out of me (I think I've done a bad mistake). I wouldn't mind providing<br>
>> a sample (even empty) icon so it would find it and it won't complain<br>
>> anymore, but I don't know where to place it.<br>
>><br>
>> Thank you in advance!<br>
><br>
> Hi Hector,<br>
><br>
> You can register a response for favicon.ico like this (pseudo-code, not tested):<br>
><br>
> '''<br>
> from pkg_resources import resource_stream<br>
><br>
> from zope.interface import Interface<br>
> import grok<br>
><br>
> class Favicon(grok.View):<br>
> grok.context(Interface)<br>
> <a href="http://grok.name" target="_blank">grok.name</a>('favicon.ico')<br>
><br>
> def render(self):<br>
> self.request.response.setHeader('Content-Type',<br>
> 'image/vnd.microsoft.icon')<br>
> return resource_stream('mypackage', 'path/to/favicon.ico')<br>
> '''<br>
><br>
> HTH,<br>
><br>
> --<br>
> Jan-Jaap Driessen<br>
><br>
_______________________________________________<br>
Grok-dev mailing list<br>
<a href="mailto:Grok-dev@zope.org">Grok-dev@zope.org</a><br>
<a href="https://mail.zope.org/mailman/listinfo/grok-dev" target="_blank">https://mail.zope.org/mailman/listinfo/grok-dev</a><br>
</div></div></blockquote></div><br>