1.1 --- a/actions/ApproveChanges.py Thu Oct 13 23:31:45 2011 +0200
1.2 +++ b/actions/ApproveChanges.py Fri Oct 14 00:16:23 2011 +0200
1.3 @@ -114,7 +114,7 @@
1.4 # Where the parent revision differs from the current revision of the
1.5 # page, attempt to merge the changes.
1.6
1.7 - query = {}
1.8 + conflict = False
1.9
1.10 if parent_rev != current_rev:
1.11
1.12 @@ -133,16 +133,9 @@
1.13
1.14 for marker in conflict_markers:
1.15 if body.find(marker) != -1:
1.16 - query = {'action' : 'edit'}
1.17 + conflict = True
1.18 break
1.19
1.20 - # Save the target page.
1.21 -
1.22 - try:
1.23 - target_page.saveText(body, 0, comment=_("Changes to page approved from queue revision %d.") % rev)
1.24 - except PageEditor.Unchanged:
1.25 - pass
1.26 -
1.27 # Delete the queued changes page.
1.28 # NOTE: The page could be deleted completely or certain revisions
1.29 # NOTE: purged.
1.30 @@ -151,9 +144,34 @@
1.31 current_page = PageEditor(request, self.pagename)
1.32 current_page.deletePage(_("Changes to page approved."))
1.33
1.34 - # Redirect to the target page, potentially in editing mode.
1.35 + # Prepare a comment.
1.36 +
1.37 + comment = _("Changes to page approved from queue revision %d.") % rev
1.38 +
1.39 + # Save the target page, but only if there is no conflict.
1.40 +
1.41 + if not conflict:
1.42 + try:
1.43 + target_page.saveText(body, 0, comment=comment)
1.44 + except PageEditor.Unchanged:
1.45 + pass
1.46 +
1.47 + # Redirect to the target page.
1.48
1.49 - request.http_redirect(target_page.url(request, query))
1.50 + request.http_redirect(target_page.url(request))
1.51 +
1.52 + # Otherwise, send the page editor.
1.53 + # NOTE: Replacing the revision in the request to prevent Moin from
1.54 + # NOTE: attempting to use the queued changes page's revision.
1.55 + # NOTE: Replacing the action and page in the request to avoid issues
1.56 + # NOTE: with editing tickets.
1.57 +
1.58 + else:
1.59 + request.rev = current_rev
1.60 + request.action = "edit"
1.61 + request.page = target_page
1.62 + target_page.sendEditor(preview=body, comment=comment, staytop=True)
1.63 +
1.64 return 1, None
1.65
1.66 def render_success(self, msg, msgtype):
2.1 --- a/to-do/record-parent-for-proper-merges.txt Thu Oct 13 23:31:45 2011 +0200
2.2 +++ b/to-do/record-parent-for-proper-merges.txt Fri Oct 14 00:16:23 2011 +0200
2.3 @@ -1,2 +1,3 @@
2.4 -Perhaps record the parent version of the edited page so that merges can be done
2.5 -between queued and normal edits.
2.6 +Done!
2.7 +(Perhaps record the parent version of the edited page so that merges can be done
2.8 +between queued and normal edits.)