[Moin-user] Re: getting notified when a page has been updated?

Nir Soffer nirs at freeshell.org
Sun Jan 29 11:39:02 EST 2006


On 29 Jan, 2006, at 21:18, Fredrik Lundh wrote:

> Fredrik Lundh wrote:
>
>> here's what I came up with:
>>
>> # wikiconfig.py
>>
>> from MoinMoin.multiconfig import DefaultConfig
>> from MoinMoin.security import Permissions
>> from MoinMoin.caching import CacheEntry
>>
>> class Config(DefaultConfig):
>>
>>     ... standard config stuff goes here ...
>>
>>     class SecurityPolicy(Permissions):
>>         def save(self, page, newtext, rev, **kw):
>>             request = page.request
>>             CacheEntry(request, page, 
>> page.getFormatterName()).remove()
>>             html = request.redirectedOutput(
>>                 page.send_page, request, count_hit=0, content_only=1
>>                 )
>
> but it looks as if I get the *previous* version of the page, which 
> isn't
> so strange, perhaps...

Yea, it is not strange, I knew it was too easy :-)

     class SecurityPolicy(Permissions):
         def save(self, page, newtext, rev, **kw):
             request = page.request
             CacheEntry(request, page, page.getFormatterName()).remove()

             # Evil hack: repalce the old text with the new
             page._set_raw_body(page.normalizeText(newtext))

             html = request.redirectedOutput(
                 page.send_page, request, count_hit=0, content_only=1)

I hope it will be enough, if not, maybe you will have to add this in 
PageEditor.saveText, which I tried to avoid but it is more correct.


Best Regards,

Nir Soffer





More information about the Moin-user mailing list