[Moin-user] Adding content (script tag) to HTML header from a macro

Nir Soffer nirs at freeshell.org
Wed Nov 30 01:49:01 EST 2005

On 30 Nov, 2005, at 11:33, Paul Moore wrote:

> In order to check if this is the first time the macro has been called
> on this page, I can add attributes to the request object

You can use this, but you don't really care how many times the macro is 
called. Use simpler code like this:

def execute(macro, args):
	if not hasattr(macro.request, 'mymacro_script_sent'):
		# send the macro once here
		macro.request.mymacro_script_sent = True
	# rest of your macro...

Best Regards,

Nir Soffer

More information about the Moin-user mailing list