[Moin-user] I think I am approaching this wrong? -- Macro not working reliably...

Schollnick, Benjamin Benjamin.Schollnick at XEROX.COM
Mon Jul 31 09:57:35 EDT 2006


I am running into a issue, that I can seemingly debug...

This Macro works fine in a PREVIEW, but when you browse normally to a
page with this macro, it acts as if it was cached somewhere (ie
application / moinmoin level?)....

Are macros cached in some manner?  Is there a better approach?

I am doing this simply because our proxy servers seem to take *minutes*
to return a page off the wiki.

The script is designed to place a notice on the website when the user is
browsing via one of our proxy servers.  It simply checks the
environmental REMOTE_ADDR against of a list of proxies and if it matches
it returns a rawHTML message, otherwise nothing...

# -*- coding: iso-8859-1 -*-

from MoinMoin.util import pysupport
from MoinMoin import user
from MoinMoin import wikiutil
import os
Dependencies = []
def execute(macro, args):
    output = []

    remote_ip_name = os.environ["REMOTE_HOST"]
    remote_ip_address = os.environ["REMOTE_ADDR"]

    x = macro.formatter.rawHTML (" ")
    if (remote_ip_address in ["", "",
        x = macro.formatter.rawHTML ("<HR><B>You are currently using a
proxy server (%s)</B><HR>" % remote_ip_address)
    return x

More information about the Moin-user mailing list