copy_attachments: use page object

This commit is contained in:
Elan Ruusamäe 2012-09-22 22:10:50 +02:00
parent cf064d9410
commit c64f708b6d

View file

@ -56,10 +56,10 @@ def writefile(filename, content, overwrite=False):
f.write(content) f.write(content)
f.close() f.close()
# pagedir = MoinMoin page dir # page = MoinMoin Page oject
# ns = DokuWiki namespace where attachments to copy # ns = DokuWiki namespace where attachments to copy
def copy_attachments(pagedir, ns): def copy_attachments(page, ns):
srcdir = os.path.join(pagedir, 'attachments') srcdir = page.getPagePath('attachments', check_create = 0)
if not isdir(srcdir): if not isdir(srcdir):
return return
@ -203,8 +203,7 @@ def convertfile(page, output = None, overwrite = False):
copystat(pagefile, out_file) copystat(pagefile, out_file)
ID = dw.cleanID(output) ID = dw.cleanID(output)
ns = dw.getNS(ID) copy_attachments(page, dw.getNS(ID))
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(page, output = output, overwrite = overwrite) convert_editlog(page, output = output, overwrite = overwrite)