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

Nir Soffer nirs at freeshell.org
Sun Jan 29 10:12:03 EST 2006


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

> is there any straightforward way to run a piece of arbitrary code
> every time a page has been updated ?

The easiest way will be to abuse a SecurityPolicy class. It is notified 
about each read or write action, and return True or False, but it can 
also do anything you like :-)

To get the page html, I think you want to use something like this your 
SecurityPolicy, when the user is allowed to edit:

	# Invalidate the page cache
	import caching
	caching.CacheEntry(request, page, page.getFormatterName()).remove()

	# Render the page
	# You may need to hack the current user while rendering, because users 
get
	# different content according to their language, preferences and 
permissions.
	html = request.redirectedOutput(page.send_page, request, count_hit=0)

	# write the html here...
	
	return True

>
> any pointers to documentation or existing plugins that do this

Check util/antispam and search MoinMoin wiki for SecurityPolicy


Document your hack in the wiki when you finish :-)


Best Regards,

Nir Soffer





More information about the Moin-user mailing list