From 20a9c08beea01352139249a32c2183841d636887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elan=20Ruusam=C3=A4e?= Date: Thu, 20 Sep 2012 01:03:32 +0200 Subject: [PATCH] without attic allow current revision not to exist --- moin2doku.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/moin2doku.py b/moin2doku.py index 675a805..f143a10 100755 --- a/moin2doku.py +++ b/moin2doku.py @@ -189,7 +189,6 @@ def convertfile(pagedir, output = None, overwrite = False): page = Page(request, pagename, rev = rev) pagefile, realrev, exists = page.get_rev(rev = rev); - content = moin2doku(pagename, page.get_raw_body()) mtime = page.mtime_usecs() / USEC if not mtime: @@ -203,9 +202,16 @@ def convertfile(pagedir, output = None, overwrite = False): if rev == current_rev: out_file = os.path.join(output_dir, 'pages', dw.wikiFN(output)) + if not convert_attic and not exists: + # if not converting attic, allow current version may not exist anymore + continue else: out_file = os.path.join(output_dir, 'attic', dw.wikiFN(output, str(mtime))) + content = moin2doku(pagename, page.get_raw_body()) + if len(content) == 0: + raise Exception, "No content" + writefile(out_file, content, overwrite = overwrite) copystat(pagefile, out_file)