I've went with IDoNotSnapshot after all: that's what also test_bugs_webservice is using. Since there was missing documentation for translators property, I've added that too.
=== modified file 'lib/lp/services/worlddata/doc/language.txt'
--- lib/lp/services/worlddata/doc/language.txt 2010-02-17 10:39:16 +0000
+++ lib/lp/services/worlddata/doc/language.txt 2010-04-15 11:52:13 +0000
@@ -260,8 +260,40 @@ English name for a language including op
Serbian ("Latn" variant)
+translators
+===========
+
+Property `translators` contains the list of `Person`s who are considered
+translators for this language.
+
+ >>> sr = language_set.getLanguageByCode('sr')
+ >>> list(sr.translators)
+ []
+
+To be considered a translator, they must have done some translations and
+have the language among their preferred languages.
+
+ >>> translator = factory.makePerson(name=u'serbian-translator')
+ >>> translator.addLanguage(sr)
+ >>> from canonical.testing import LaunchpadZopelessLayer
+ >>> LaunchpadZopelessLayer.commit()
+
+ # We need to fake some Karma.
+ >>> from lp.registry.model.karma import KarmaCategory, KarmaCache
+ >>> LaunchpadZopelessLayer.switchDbUser('karma')
+ >>> translations_category = KarmaCategory.selectOne(
+ ... KarmaCategory.name=='translations')
+ >>> karma = KarmaCache(person=translator,
+ ... category=translations_category,
+ ... karmavalue=1)
+ >>> LaunchpadZopelessLayer.commit()
+ >>> LaunchpadZopelessLayer.switchDbUser('launchpad')
+ >>> [translator.name for translator in sr.translators]
+ [u'serbian-translator']
+
+
=========
-countries
+Countries
=========
Property holding a list of countries a language is spoken in, and allowing
=== modified file 'lib/lp/services/worlddata/tests/test_doc.py'
--- lib/lp/services/worlddata/tests/test_doc.py 2009-06-30 16:56:07 +0000
+++ lib/lp/services/worlddata/tests/test_doc.py 2010-04-15 11:51:21 +0000
@@ -6,9 +6,20 @@ Run the doctests and pagetests.
"""
import os
+
+from canonical.launchpad.testing.systemdocs import (
+ LayeredDocFileSuite, setUp, tearDown)
+from canonical.testing import LaunchpadZopelessLayer
+
from lp.services.testing import build_test_suite
=== added file 'lib/lp/services/worlddata/tests/test_language.py'
--- lib/lp/services/worlddata/tests/test_language.py 1970-01-01 00:00:00 +0000
+++ lib/lp/services/worlddata/tests/test_language.py 2010-04-15 11:49:44 +0000
@@ -0,0 +1,21 @@
+# Copyright 2010 Canonical Ltd. This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+__metaclass__ = type
+
+from canonical.testing import FunctionalLayer
+from lazr.lifecycle.interfaces import IDoNotSnapshot
+from lp.services.worlddata.interfaces.language import ILanguage
+from lp.testing import TestCaseWithFactory
+
+
+class TestLanguageWebservice(TestCaseWithFactory):
+ """Test Language web service API."""
+
+ layer = FunctionalLayer
+
+ def test_translators(self):
+ self.failUnless(
+ IDoNotSnapshot.providedBy(ILanguage['translators']),
+ "ILanguage.translators should not be included in snapshots, "
+ "see bug 553093.")
I've went with IDoNotSnapshot after all: that's what also test_bugs_ webservice is using. Since there was missing documentation for translators property, I've added that too.
=== modified file 'lib/lp/ services/ worlddata/ doc/language. txt' services/ worlddata/ doc/language. txt 2010-02-17 10:39:16 +0000 services/ worlddata/ doc/language. txt 2010-04-15 11:52:13 +0000
--- lib/lp/
+++ lib/lp/
@@ -260,8 +260,40 @@ English name for a language including op
Serbian ("Latn" variant)
+translators set.getLanguage ByCode( 'sr') translators) makePerson( name=u' serbian- translator' ) addLanguage( sr) ssLayer ssLayer. commit( ) model.karma import KarmaCategory, KarmaCache ssLayer. switchDbUser( 'karma' ) category = KarmaCategory. selectOne( name==' translations' ) person= translator, translations_ category, ssLayer. commit( ) ssLayer. switchDbUser( 'launchpad' ) translator' ]
+===========
+
+Property `translators` contains the list of `Person`s who are considered
+translators for this language.
+
+ >>> sr = language_
+ >>> list(sr.
+ []
+
+To be considered a translator, they must have done some translations and
+have the language among their preferred languages.
+
+ >>> translator = factory.
+ >>> translator.
+ >>> from canonical.testing import LaunchpadZopele
+ >>> LaunchpadZopele
+
+ # We need to fake some Karma.
+ >>> from lp.registry.
+ >>> LaunchpadZopele
+ >>> translations_
+ ... KarmaCategory.
+ >>> karma = KarmaCache(
+ ... category=
+ ... karmavalue=1)
+ >>> LaunchpadZopele
+ >>> LaunchpadZopele
+ >>> [translator.name for translator in sr.translators]
+ [u'serbian-
+
+
=========
-countries
+Countries
=========
Property holding a list of countries a language is spoken in, and allowing
=== modified file 'lib/lp/ services/ worlddata/ tests/test_ doc.py' services/ worlddata/ tests/test_ doc.py 2009-06-30 16:56:07 +0000 services/ worlddata/ tests/test_ doc.py 2010-04-15 11:51:21 +0000
--- lib/lp/
+++ lib/lp/
@@ -6,9 +6,20 @@ Run the doctests and pagetests.
"""
import os launchpad. testing. systemdocs import ( uite, setUp, tearDown) ssLayer
+
+from canonical.
+ LayeredDocFileS
+from canonical.testing import LaunchpadZopele
+
from lp.services.testing import build_test_suite
here = os.path. dirname( os.path. realpath( __file_ _)) uite( language. txt', ZopelessLayer,
+special = {
+ 'language.txt': LayeredDocFileS
+ '../doc/
+ layer=Launchpad
+ setUp=setUp, tearDown=tearDown),
+ }
def test_suite(): suite(here) suite(here, special)
- return build_test_
+ return build_test_
=== added file 'lib/lp/ services/ worlddata/ tests/test_ language. py' services/ worlddata/ tests/test_ language. py 1970-01-01 00:00:00 +0000 services/ worlddata/ tests/test_ language. py 2010-04-15 11:49:44 +0000 interfaces import IDoNotSnapshot worlddata. interfaces. language import ILanguage service( TestCaseWithFac tory): s(self) : providedBy( ILanguage[ 'translators' ]), translators should not be included in snapshots, "
--- lib/lp/
+++ lib/lp/
@@ -0,0 +1,21 @@
+# Copyright 2010 Canonical Ltd. This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+__metaclass__ = type
+
+from canonical.testing import FunctionalLayer
+from lazr.lifecycle.
+from lp.services.
+from lp.testing import TestCaseWithFactory
+
+
+class TestLanguageWeb
+ """Test Language web service API."""
+
+ layer = FunctionalLayer
+
+ def test_translator
+ self.failUnless(
+ IDoNotSnapshot.
+ "ILanguage.
+ "see bug 553093.")