[Grok-dev] NotFound: Object: <zope.site.folder.Folder object at 0x#######>, name: u'favicon.ico'
Hector Blanco
white.lists at gmail.com
Sun Jan 9 16:45:51 EST 2011
Thank you for the follow-up, guys!
It is finally working. I decided to go with the resource_string...
---------------------------------------------
from pkg_resources import resource_string
# [ . . . ]
class Favicon(grok.View):
grok.context(Interface)
grok.name('favicon.ico')
def render(self):
return resource_string(__name__, "static/img/icons/favicon.ico")
---------------------------------------------
Now I have realized that the favicon looks horrible and that I have to
re-design it but hey... that wasn't the point here :-D
Thank you so much!
2010/12/31 Jan-Jaap Driessen <jdriessen at thehealthagency.com>:
> On 31 December 2010 11:39, Vincent Fretin <vincent.fretin at gmail.com> wrote:
>> Hi,
>>
>> With the code given by Jan-Jaap, if you try to access to favicon.ico, you
>> get:
>> TypeError: The result should be None, a string, or adaptable to IResult.
>>
>> Simply add read() and it works fine. I can see the favicon in the url bar.
>> return resource_stream('dolmenexample', 'favicon.ico').read()
>
> Or use resource_string(...) instead of resource_stream(...).read()
>
>> Happy new year!
>>
>> Vincent
>>
>
> --
> Jan-Jaap Driessen
>
More information about the Grok-dev
mailing list