[GeneralDiscussion] Re: zope/plone article

[email protected] (Niall Douglas) Fri, 06 Mar 2009 11:13:54 -0800
Newsgroups gmane.comp.web.zope.zwiki
Message-ID <49B175D4.11399.A96D15C__41151.2069673792$1236366954$gmane$org@s_sourceforge.nedprod.com>
On 6 Mar 2009 at 8:07, Simon Michael wrote:

> The caching investigation is very much appreciated, I assume you're  
> referring to some issue page or other. It's over my head just now and  
> not causing me problems in daily zwiki usage so I'll have to say  
> "patches welcome".

Ah sorry - it's issue number #1316 
(http://zwiki.org/1316FireFoxDoesntLoadChangesAfterEditingWith304Enabl
ed) which I found from 
http://zwiki.org/HowToEnableConditionalHTTPGET304.

I didn't post a patch because the fix is ridiculously easy: in 
ZWikiPage.py:handle_modified_headers every time where it does:

        RESPONSE.setHeader('Last-Modified', rfc1123_date(last_mod))

... simply do:

        RESPONSE.setHeader('Last-Modified', rfc1123_date(last_mod))
        RESPONSE.setHeader('Cache-Control', 'max-age=86400, s-
maxage=86400, public, must-revalidate, proxy-revalidate')

I'd do a find for 'Last-Modified' and add the Cache-Control as 
required.

> FWIW, in the past I found RemoteWikiLinks weren't worth the bother,  
> because it was one more non-standard linking scheme for people to  
> learn and it obscured where the link really went - ordinary bare urls  
> or manual hyperlinks were clearer.

It's an issue of maintainability, then appearance yes.

> If you're into RST, maybe another option is to have the format method  
> in rst.py append the contents of the masterinclude page before RST  
> rendering. And on that page, define the link targets, RST footnote- 
> style. This forces you to define each individual url though, not just  
> a base url like RemoteWikiLinks. So probably not worth it.

It also means altering the source which isn't available to me. 
Similarly I'm stuck on 0.60 of zwiki because that's the latest in 
Ubuntu.

> > To make use of varnish, you need a minimum of conditional HTTP
> > working. I turned on conditional HTTP gets - the zwiki code reports
> > the datestamp for the page which is to be expected, but this ignores
> > the masterinclude. I can't see any way of overriding this date in the
> > zwiki source - would adding this facility be a good idea as who knows
> > what templates may do with rendering zwiki pages? If they had a
> > publicly available method to call it would be useful.
> 
> Yes that might be worthwhile. Though it's a bit of a small niche right  
> now.

True.

I have another bug - this time in Preview mode where it isn't 
previewing correctly because the temporary page object isn't copying 
its attributes from its master page (e.g. "allow_dtml=1"). In 
common.py:renderText():

        # make a new page object, like in create
        p = page.__class__(__name__=page.getId())
        p.title = page.pageName()
        p = p.__of__(page.aq_parent)
        p.setPageType(self.id())
        p.setText(text)
        return p.render(

Here it sets up the temporary page object and it doesn't copy over 
attributes. Therefore, previewing a page with DTML enabled just for 
that page doesn't work.

Fraid I have no idea how to copy across attributes in Zope. 
p.setattr('allow_dtml', page.getattr('allow_dtml',0)) is fairly 
obvious but I couldn't figure out how to iterate all attributes.

Cheers,
Niall


--
forwarded from http://zwiki.org/GeneralDiscussion#msg49B175D4.11399.A96D15C@s_sourceforge.nedprod.com