Quantcast

Re: Static Resources

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Static Resources

paul-495
Hi, Jan,

I think Noe's answer "sorta" helped.  The problem with doing it through
resource.need(), is that for a favicon.ico, the link header should be
something like:

        <link  rel="SHORTCUT ICON"type="image/x-icon"href="path to .ico file" />

If you just use resource.need(), you get the href bit right, but the
"rel=" and "type=" parts are not right.  I eventually settled for doing:

        <link  rel="SHORTCUT ICON"type="image/x-icon"href="@@/fanstatic/appname/favico.ico" />

Which seems to work ok.

Its not a patch though on the fun I had trying to share page template
macros between modules.  Each module expects it's page templates to
reside in a modulename_templates directory.  I never could figure out
how to make different modules use the same template macro file.  Ended
up copying the lot.

I must say that I found the inclusion of fanstatic in the last Grok
release a bit confusing at first.  No doubt there are benefits to the
fanstatic approach, but there's a bit more to remember and to configure
for projects.  Also, the extent of work I had to do to port my project
from the previous Grok release seemed a bit extreme.

If all that sounds like complaining, it's not really.   I _love_ Grok!

Thanks for asking,
Paul


_______________________________________________
Grok-dev mailing list
[hidden email]
https://mail.zope.org/mailman/listinfo/grok-dev

paul.vcf (428 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Static Resources

Alexandre Garel-2
Le 19/09/2011 15:11, paul a écrit :
Hi, Jan,

I think Noe's answer "sorta" helped.  The problem with doing it through resource.need(), is that for a favicon.ico, the link header should be something like:

    <link  rel="SHORTCUT ICON"type="image/x-icon"href="path to .ico file" />

If you just use resource.need(), you get the href bit right, but the "rel=" and "type=" parts are not right.  I eventually settled for doing:

    <link  rel="SHORTCUT ICON"type="image/x-icon"href=[hidden email] />

Which seems to work ok.

Here, using fanstatic 0.11.2, the ".ico" of the ressource make it recognized as a favicon and fanstatic automatically represent it with :
<link rel="shortcut icon" type="image/x-icon" href="<a href="view-source:http://localhost:8081/fanstatic/vigirisk_library/:version:2011-09-12T11:00:54.09/favicon.ico">xxxxx"/>

It's done by function render_ico in core.py registere for '.ico'

Cheers,

Alex

_______________________________________________
Grok-dev mailing list
[hidden email]
https://mail.zope.org/mailman/listinfo/grok-dev
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Static Resources

Jan-Wijbrand Kolman-3
On 9/21/11 09:11 , Alexandre Garel wrote:

> Le 19/09/2011 15:11, paul a écrit :
>> Hi, Jan,
>>
>> I think Noe's answer "sorta" helped. The problem with doing it through
>> resource.need(), is that for a favicon.ico, the link header should be
>> something like:
>>
>> <link rel="SHORTCUT ICON"type="image/x-icon"href="path to .ico file" />
>>
>> If you just use resource.need(), you get the href bit right, but the
>> "rel=" and "type=" parts are not right. I eventually settled for doing:
>>
>> <link rel="SHORTCUT
>> ICON"type="image/x-icon"href="@@/fanstatic/appname/favico.ico" />
>>
>> Which seems to work ok.
>
> Here, using fanstatic 0.11.2, the ".ico" of the ressource make it
> recognized as a favicon and fanstatic automatically represent it with :
>
> <link  rel="shortcut icon"type="image/x-icon"href="xxxxx  <view-source:http://localhost:8081/fanstatic/vigirisk_library/:version:2011-09-12T11:00:54.09/favicon.ico>"/>
>
> It's done by function render_ico in core.py registere for '.ico'

And, in addition to this answer, it is not very difficult to plugin your
own renderer for specific types of resources. Something like this:

   from fanstatic import Library, Resource

   library = Library('entrypointname', 'dirname')

   def render_apple_touch_icon(url):
     return '<link rel="apple-touch-icon" href="%s" />' % url

   apple_touch_icon = Resource(
     library,
     'img/apple-touch-icon.png',
     renderer=render_apple_touch_icon)


regards, jw

_______________________________________________
Grok-dev mailing list
[hidden email]
https://mail.zope.org/mailman/listinfo/grok-dev
Loading...