Repository: translate/pootle

Issue:
Move projectcheckers from ttk to pootle
currently the `Project.checkers` field uses `translate.filters.checks.project_checkers` to set its choices.

while this is not exactly "dynamic" it creates a problem if ttk/pootle versions dont match and pootle wants to create a migration.

i would propose that the best solution is to move projectcheckers into `pootle_project`, and remove the validation step here:
 https://github.com/translate/translate/blob/master/translate/storage/poheader.py#L356

...on the basis that its not ttk's job to verify what is a valid projectchecker for this particular Pootle Project.



Discussion:

Resolving patch:
diff --git a/pootle/apps/pootle_project/models.py b/pootle/apps/pootle_project/models.py
--- a/pootle/apps/pootle_project/models.py
+++ b/pootle/apps/pootle_project/models.py
@@ -41,6 +41,17 @@
 
 
 RESERVED_PROJECT_CODES = ('admin', 'translate', 'settings')
+PROJECT_CHECKERS = {
+    "standard": checks.StandardChecker,
+    "openoffice": checks.OpenOfficeChecker,
+    "libreoffice": checks.LibreOfficeChecker,
+    "mozilla": checks.MozillaChecker,
+    "kde": checks.KdeChecker,
+    "wx": checks.KdeChecker,
+    "gnome": checks.GnomeChecker,
+    "creativecommons": checks.CCLicenseChecker,
+    "drupal": checks.DrupalChecker,
+    "terminology": checks.TermChecker}
 
 
 class ProjectManager(models.Manager):
@@ -146,13 +157,16 @@ class Project(models.Model, CachedTreeItem, ProjectURLMixin):
     fullname = models.CharField(max_length=255, null=False,
                                 verbose_name=_("Full Name"))
 
-    checker_choices = [('standard', 'standard')]
-    checkers = list(checks.projectcheckers.keys())
-    checkers.sort()
-    checker_choices.extend([(checker, checker) for checker in checkers])
-    checkstyle = models.CharField(max_length=50, default='standard',
-                                  null=False, choices=checker_choices,
-                                  verbose_name=_('Quality Checks'))
+    checker_choices = [
+        (checker, checker)
+        for checker
+        in sorted(PROJECT_CHECKERS.keys())]
+    checkstyle = models.CharField(
+        max_length=50,
+        default='standard',
+        null=False,
+        choices=checker_choices,
+        verbose_name=_('Quality Checks'))
 
     localfiletype = models.CharField(max_length=50, default="po",
                                      verbose_name=_('File Type'))
diff --git a/pytest_pootle/fixtures/models/translation_project.py b/pytest_pootle/fixtures/models/translation_project.py
--- a/pytest_pootle/fixtures/models/translation_project.py
+++ b/pytest_pootle/fixtures/models/translation_project.py
@@ -12,6 +12,13 @@
 import pytest
 
 
+def pytest_generate_tests(metafunc):
+    from pootle_project.models import PROJECT_CHECKERS
+
+    if 'checkers' in metafunc.funcargnames:
+        metafunc.parametrize("checkers", PROJECT_CHECKERS.keys())
+
+
 def _require_tp(language, project):
     """Helper to get/create a new translation project."""
     from pootle_translationproject.models import create_translation_project
@@ -77,17 +84,11 @@ def afrikaans_vfolder_test(afrikaans, vfolder_test):
     return _require_tp(afrikaans, vfolder_test)
 
 
-def get_project_checkers():
-    from translate.filters import checks
-
-    return ['standard'] + list(checks.projectcheckers.keys())
-
-
-@pytest.fixture(params=get_project_checkers())
-def tp_checker_tests(request, english):
+@pytest.fixture
+def tp_checker_tests(request, english, checkers):
     from pytest_pootle.factories import ProjectFactory
 
-    checker_name = request.param
+    checker_name = checkers
     project = ProjectFactory(
         checkstyle=checker_name,
         source_language=english)


Test patch: