Submitted by : wlang at: 2007-05-10T09:15:29-07:00 (10 years ago)
Name :
Category : Severity : Status :
Optional subject :  
Optional comment :

Currently, the link to the stylesheet looks like that:

skins/zwiki/maintemplate.pt:
[...]
tal:attributes="href string:${here/defaultPageUrl}/stylesheet

Assume you have a wiki folder, which is generally read protected, but there is one page in it (PublicPage), that you want open for public.

So you go to the ZMI, select the PublicPage security tab and set the View permission to anonymous. Nevertheless, an unauthenticated user will get an authentication dialog.

Reason: the above tal expression will evaluate to:

http://.../FrontPage/stylesheet

and FrontPage (or whatever your default page is) is not viewable, hence the authentication dialog.

Proposed fix: use wikiUrl instead of defaultPageUrl:

$ darcs diff -u skins/zwiki/maintemplate.pt
--- old-ZWiki/skins/zwiki/maintemplate.pt   2007-05-10 01:48:46.000000000 +0200
+++ new-ZWiki/skins/zwiki/maintemplate.pt   2007-05-10 01:48:46.000000000 +0200
@@ -14,7 +14,7 @@
       <link rel="icon" href="favicon"/>
     </tal:block>
     <link rel="stylesheet" type="text/css" href=""
-          tal:attributes="href string:${here/defaultPageUrl}/stylesheet"
+          tal:attributes="href string:${here/wikiUrl}/stylesheet"
           />
     <title metal:define-slot="title_slot" tal:content="
            string:${container/title} ${here/pageName}" />

That's assuming there is a "stylesheet" in the ZODB --betabug, Fri, 11 May 2007 00:26:13 -0700 reply

This won't work for most people: wikiUrl returns return self.folder().absolute_url(), which is the URL to the folder. Our "stylesheet" may be in there (as a ZPT with id "stylesheet"), but it may also be in:

Calling FrontPage/stylesheet gives you the methods stylesheet() defined in Views.py, which tries to find any of these (in a predetermined order).

In your case I'd change the template in question to point to that one page that is readable (e.g. IntroductionPage?) and then /stylesheet, i.e. IntroductionPage?/stylesheet. If you have this in the template, then all pages are using it, and it again allows for caching of the stylesheet file.

That's assuming there is a "stylesheet" in the ZODB --wlang, Fri, 11 May 2007 00:39:16 -0700 reply

Oops, you're right. Thanks for the clarification!

... --wlang, Fri, 11 May 2007 00:39:44 -0700 reply

Status: open => closed