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

Fredrik Lundh fredrik at pythonware.com
Sun Jan 29 12:01:03 EST 2006


Nir Soffer wrote:

> 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.

here's a variant that seems to work:

        def save(self, editor, newtext, rev, **kw):
            request = editor.request
            text = editor.get_raw_body()
            editor.set_raw_body(editor.normalizeText(newtext), modified=1)
            html = request.redirectedOutput(
                editor.send_page, request, count_hit=0, content_only=1
                )
            editor.set_raw_body(text)

            ...

(let me know if I've done something really stupid)

many thanks /F







More information about the Moin-user mailing list