1.1 --- a/events/queue_for_review.py Sun Oct 09 20:37:21 2011 +0200
1.2 +++ b/events/queue_for_review.py Sun Oct 09 21:17:09 2011 +0200
1.3 @@ -11,28 +11,21 @@
1.4
1.5 from MoinMoin.PageEditor import PageEditor
1.6 from MoinMoin.events import PagePreSaveEvent, Abort
1.7 -import re
1.8 -
1.9 -def match_queue_pages(pagename, queued_changes_area):
1.10 -
1.11 - "Return a filter function which matches subpages of 'pagename'."
1.12 -
1.13 - return re.compile(ur"^%s/%s/.*$" % (re.escape(pagename), re.escape(queued_changes_area)), re.UNICODE).match
1.14 +from ApproveChangesSupport import *
1.15
1.16 def handle_presave(event):
1.17 request = event.request
1.18 _ = request.getText
1.19
1.20 - approved_editors_group = getattr(request.cfg, "approved_editors_group", "ApprovedGroup")
1.21 - queued_changes_area = getattr(request.cfg, "queued_changes_area", "ApprovalQueue")
1.22 + approved_editors_group = get_approved_editors_group(request)
1.23 + queued_changes_area = get_queued_changes_area(request)
1.24
1.25 pagename = event.page_editor.page_name
1.26 - parts = pagename.split("/")
1.27
1.28 # Saving into queues has to be permitted or the mechanism will keep trying
1.29 # to save into a queue of the specified page.
1.30
1.31 - if len(parts) > 2 and parts[-2] == queued_changes_area:
1.32 + if is_queued_page(pagename, queued_changes_area):
1.33 return None
1.34
1.35 # For normal pages, the user has to be approved. Otherwise, the page will be
1.36 @@ -47,7 +40,7 @@
1.37
1.38 queue_number = -1
1.39
1.40 - for name in request.rootpage.getPageList(exists=1, filter=match_queue_pages(pagename, queued_changes_area)):
1.41 + for name in get_queue_pages(request, pagename, queued_changes_area):
1.42 number = name.split("/")[-1]
1.43 if number.isdigit():
1.44 queue_number = max(queue_number, int(number))