1.1 --- a/ApproveChangesSupport.py Mon Oct 10 22:15:09 2011 +0200
1.2 +++ b/ApproveChangesSupport.py Mon Oct 10 22:28:58 2011 +0200
1.3 @@ -10,42 +10,24 @@
1.4
1.5 __version__ = "0.1"
1.6
1.7 -def get_queued_changes_area(request):
1.8 - return getattr(request.cfg, "queued_changes_area", "ApprovalQueue")
1.9 +def get_queued_changes_page(request):
1.10 + return getattr(request.cfg, "queued_changes_page", "ApprovalQueue")
1.11
1.12 def get_approved_editors_group(request):
1.13 return getattr(request.cfg, "approved_editors_group", "ApprovedGroup")
1.14
1.15 -def match_queue_pages(pagename, queued_changes_area):
1.16 -
1.17 - "Return a filter function which matches subpages of 'pagename'."
1.18 -
1.19 - return re.compile(ur"^%s/%s/.*$" % (re.escape(pagename), re.escape(queued_changes_area)), re.UNICODE).match
1.20 -
1.21 -def get_queue_pages(request, pagename, queued_changes_area):
1.22 +def is_queued_changes_page(request, pagename):
1.23
1.24 - """
1.25 - Return the queued pages given the 'request', 'pagename' and subpage folder
1.26 - specified by 'queued_changes_area'.
1.27 - """
1.28 -
1.29 - return request.rootpage.getPageList(exists=1, filter=match_queue_pages(pagename, queued_changes_area))
1.30 -
1.31 -def is_queued_page(pagename, queued_changes_area):
1.32 -
1.33 - """
1.34 - Return whether 'pagename' is a queued page by testing for the presence of
1.35 - the 'queued_changes_area' component in its page path.
1.36 - """
1.37 + "Return whether 'pagename' is a queued changes page by testing its name."
1.38
1.39 parts = pagename.split("/")
1.40 - return len(parts) > 2 and parts[-2] == queued_changes_area
1.41 + return len(parts) > 1 and parts[-1] == get_queued_changes_page(request)
1.42
1.43 def get_target_page_name(pagename):
1.44
1.45 - "Return the target page name for the given queued 'pagename'."
1.46 + "Return the target page name for the given queued changes 'pagename'."
1.47
1.48 - return "/".join(pagename.split("/")[:-2])
1.49 + return "/".join(pagename.split("/")[:-1])
1.50
1.51 # Utility classes and associated functions.
1.52 # NOTE: These are a subset of EventAggregatorSupport.