convert_editlog: take page as input

This commit is contained in:
Elan Ruusamäe 2012-09-22 22:04:08 +02:00
parent 5313705a0a
commit cf064d9410

View file

@ -94,14 +94,12 @@ def print_help():
def wikiname(filename): def wikiname(filename):
return wikiutil.unquoteWikiname(basename(filename)) return wikiutil.unquoteWikiname(basename(filename))
def convert_editlog(pagedir, output = None, overwrite = False): def convert_editlog(page, output = None, overwrite = False):
pagedir = os.path.abspath(pagedir) pagedir = page.getPagePath()
print "pagedir: %s" % pagedir
pagename = wikiname(pagedir) pagename = wikiname(pagedir)
if not output: if not output:
output = pagename output = pagename
pagelog = os.path.join(pagedir, 'edit-log') edit_log = editlog.EditLog(request, page.getPagePath('edit-log'))
edit_log = editlog.EditLog(request, filename = pagelog)
changes = {} changes = {}
for log in edit_log: for log in edit_log:
@ -209,7 +207,7 @@ def convertfile(page, output = None, overwrite = False):
copy_attachments(pagedir, ns) copy_attachments(pagedir, ns)
# convert edit-log, it's always present even if current page is not # convert edit-log, it's always present even if current page is not
convert_editlog(pagedir, output = output, overwrite = overwrite) convert_editlog(page, output = output, overwrite = overwrite)
# add to redirect.conf if filenames differ # add to redirect.conf if filenames differ
# and page must exist (no redirect for deleted pages) # and page must exist (no redirect for deleted pages)