1.1 --- a/convert.py Fri Jun 16 17:06:10 2017 +0200
1.2 +++ b/convert.py Fri Jun 16 17:07:06 2017 +0200
1.3 @@ -3,7 +3,7 @@
1.4 """
1.5 Confluence XML dump conversion to a MoinMoin-compatible representation.
1.6
1.7 -Copyright (C) 2012, 2013 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2012, 2013, 2017 Paul Boddie <paul@boddie.org.uk>
1.9
1.10 This software is free software; you can redistribute it and/or
1.11 modify it under the terms of the GNU General Public License as
1.12 @@ -130,7 +130,7 @@
1.13 content["version"],
1.14 versionfile,
1.15 title, # comment titles will incorporate the comment's position
1.16 - content["lastModifierName"],
1.17 + content.get("lastModifierName") or content.get("lastModifier"),
1.18 content["versionComment"],
1.19 date_to_seconds(content["lastModificationDate"])
1.20 ))
1.21 @@ -185,8 +185,8 @@
1.22 # Handle attachments.
1.23
1.24 elif objecttype == "Attachment":
1.25 - pageid = content["content"]
1.26 - version = content["attachmentVersion"]
1.27 + pageid = content.get("content") or content.get("containerContent")
1.28 + version = content.get("attachmentVersion") or content.get("version") or 0
1.29
1.30 if content.has_key("originalVersion"):
1.31 attachid = content["originalVersion"]
1.32 @@ -199,10 +199,10 @@
1.33 # Have to "taint" archive filenames, although Moin will
1.34 # probably handle package script filename tainting.
1.35 wikiutil.taintfilename(join("attachments", pageid, attachid, version)),
1.36 - wikiutil.taintfilename(content["fileName"]),
1.37 + wikiutil.taintfilename(content.get("fileName") or content.get("title")),
1.38 "", # pagename is substituted later
1.39 - content["lastModifierName"],
1.40 - content["comment"],
1.41 + content.get("lastModifierName") or content.get("lastModifier"),
1.42 + content.get("comment") or content.get("versionComment"),
1.43 date_to_seconds(content["lastModificationDate"])
1.44 ))
1.45