[Moin-user] making a macro to tell the page rev number
Kirby Moyers
kdmoyers at gmail.com
Thu Dec 10 15:41:00 EST 2009
I'm having trouble making a macro to tell the page rev number
and last rev date. My short poor attempt is listed below. I am a
fairly experienced coder, but have never worked with python before.
The calculation of the rev number works sometimes, but
other times makes an error "unsubscriptable", I guess
because the expression did not return a list. Is there
a more reliable way to get the rev number?
The rev date calculation is just me taking shots
in the dark. I have no firm idea how to find this value.
Anyone got an idea how to find these two values?
As last ditch, I guess I could try to go find the edit-log
file and read out the last line, but that seemed to violate
the general flow of the 1.8.5 moinmoin code.
Thanks in advance for any help!!
-Kirby
from MoinMoin.wikiutil import get_unicode, get_bool, get_int, get_float
Dependencies = []
generates_headings = False
def macro_PageRevision(macro):
# arguments passed in can be None or a unicode object
Dependencies = ["pages"] # is this right??
# saw suggestion: macro.form.get("rev") which sometimes produces [u'25']
# saw suggestion: macro.request.page.rev which always produces 0
thisrev = int(macro.form.get("rev")[0])+1 # this actually worked sometimes
thistim = macro.form.get('time', [''])[0] # this never worked
return macro.formatter.text("Rev "+thisrev+" "+thistim)
More information about the Moin-user
mailing list