Merge lp:~danilo/launchpad/bug-553093 into lp:launchpad
Status: | Merged |
---|---|
Approved by: | Данило Шеган |
Approved revision: | no longer in the source branch. |
Merged at revision: | not available |
Proposed branch: | lp:~danilo/launchpad/bug-553093 |
Merge into: | lp:launchpad |
Diff against target: |
172 lines (+79/-33) 5 files modified
lib/lp/services/worlddata/doc/language.txt (+33/-1) lib/lp/services/worlddata/interfaces/language.py (+3/-2) lib/lp/services/worlddata/tests/test_doc.py (+12/-1) lib/lp/services/worlddata/tests/test_language.py (+21/-0) lib/lp/translations/templates/language-index.pt (+10/-29) |
To merge this branch: | bzr merge lp:~danilo/launchpad/bug-553093 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Nelson (community) | code ui | Approve | |
Review via email: mp+23458@code.launchpad.net |
Commit message
Do not include translators list in the snapshot of the object, to avoid OOPSing when administering languages.
Description of the change
= Bug 553093 =
This fixes an OOPS which happens because we are snapshoting a full object with the exported API, and when translators property has more than 1000 entries, a shortlist in the snapshot implementation fails.
Fix is simple: just encapsulate doNotSnapshot().
I am struggling with the test, though. I tried making a unit test, but uncommitted it: it was too slow (creating 1001 persons with some karma), and didn't really work (switching DB users to create karma and persons, and then coming back to the regular test user made it impossible to also construct views). I did do this in my local launchpad-dev DB and tested that the fix works correctly.
Along the way, I've fixed a bunch of formatting problems on the page.
See https:/
=== removed file 'lib/lp/ translations/ browser/ tests/test_ language_ views.py' translations/ browser/ tests/test_ language_ views.py 2010-04-13 11:58:43 +0000 translations/ browser/ tests/test_ language_ views.py 1970-01-01 00:00:00 +0000 launchpad. webapp. servers import LaunchpadTestRe quest ssLayer model.karma import KarmaCategory, KarmaCache worlddata. interfaces. language import ILanguageSet .browser. language import LanguageAdminView inView( TestCaseWithFac tory): ssLayer minView( self, language): anslators( self, language, total=2): makePerson( ) addLanguage( language) append( person) category = KarmaCategory. selectOne( name==' translations' ) ssLayer. switchDbUser( 'karma' ) person= person, translations_ category, ssLayer. commit( ) ILanguageSet) .getLanguageByC ode('sr' ) ageTranslators( serbian, 1001) ssLayer. switchDbUser( 'launchpad' ) ew(serbian, LaunchpadTestRe quest(form= form)) extFromData( form)
--- lib/lp/
+++ lib/lp/
@@ -1,54 +0,0 @@
-# Copyright 2010 Canonical Ltd. This software is licensed under the
-# GNU Affero General Public License version 3 (see the file LICENSE).
-
-__metaclass__ = type
-
-import unittest
-
-from zope.component import getUtility
-from zope.security.proxy import removeSecurityProxy
-
-from canonical.
-from canonical.testing import LaunchpadZopele
-from lp.registry.
-from lp.services.
-from lp.testing import TestCaseWithFactory
-from lp.translations
-
-
-class TestLanguageAdm
- """Test Language web service API."""
-
- layer = LaunchpadZopele
-
- def setUpLanguageAd
- return view
-
- def setUpLanguageTr
- people = []
-
- for count in range(total):
- person = self.factory.
- person.
- people.
-
- translations_
- KarmaCategory.
- LaunchpadZopele
- for person in people:
- # Fake some translations Karma for these Serbian people.
- karma = KarmaCache(
- category=
- karmavalue=1)
- LaunchpadZopele
-
- def test_post(self):
- serbian = getUtility(
- self.setUpLangu
-
- LaunchpadZopele
- form = {}
- view = LanguageAdminVi
- view.initialize()
- view.updateCont
-