changeset 372:4c9654b4f335

CheckTranslation: add pageset selector
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 19 Apr 2009 14:19:07 +0200
parents 36a99c8244dc
children 0edec6b35559
files data/plugin/action/CheckTranslation.py
diffstat 1 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/data/plugin/action/CheckTranslation.py	Sun Apr 19 13:56:47 2009 +0200
+++ b/data/plugin/action/CheckTranslation.py	Sun Apr 19 14:19:07 2009 +0200
@@ -23,12 +23,9 @@
     _ = request.getText
 
     pageset_name = request.values.get('pageset')
-    try:
-        pageset = getattr(i18n.strings, pageset_name)
-        assert isinstance(pageset, (list, tuple))
-    except (AttributeError, TypeError, AssertionError):
+    if pageset_name not in i18n.strings.pagesets:
         pageset_name = 'all_pages'
-        pageset = getattr(i18n.strings, pageset_name)
+    pageset = getattr(i18n.strings, pageset_name)
 
     lang = request.values.get('language') or request.lang or 'en'
     wiki_languages = sorted(i18n.wikiLanguages().keys())
@@ -92,10 +89,20 @@
 
     lang_selector = u''.join([fmt.paragraph(1), _("Choose:"), ' ', ' '.join(lang_links), fmt.paragraph(0)])
 
+    pageset_links = [this_page.link_to_raw(request, _pageset_name,
+                                           querystr={'action': 'CheckTranslation',
+                                                     'language': lang,
+                                                     'pageset': _pageset_name, })
+                     for _pageset_name in sorted(i18n.strings.pagesets)]
+
+
+    pageset_selector = u''.join([fmt.paragraph(1), _("Choose:"), ' ', ' '.join(pageset_links), fmt.paragraph(0)])
+
     title = _("Checking translation '%s' for page set '%s'") % (lang, pageset_name)
     request.theme.send_title(title, page=request.page, pagename=pagename)
     request.write(request.formatter.startContent("content"))
     request.write(lang_selector)
+    request.write(pageset_selector)
     request.write(page_table)
     request.write(request.formatter.endContent())
     request.theme.send_footer(pagename)