Code review comment for lp:~adiroiban/launchpad/bug-497438

Revision history for this message
Adi Roiban (adiroiban) wrote :

Here is the latest diff.

Many thanks for the review!

=== modified file 'lib/canonical/launchpad/security.py'
--- lib/canonical/launchpad/security.py 2009-12-18 13:25:19 +0000
+++ lib/canonical/launchpad/security.py 2009-12-21 15:17:16 +0000
@@ -1678,7 +1678,7 @@
     def checkAuthenticated(self, user):
         """Is the user able to manage `IDistroSeries` translations.

- Disribution managers can also manage IDistroSeries
+ Distribution managers can also manage IDistroSeries
         """
         return (AdminDistributionTranslations(
             self.obj.distribution).checkAuthenticated(user))
@@ -1691,7 +1691,7 @@
     def checkAuthenticated(self, user):
         """Is the user able to manage `IDistroSeriesLanguage` translations.

- Disribution managers can also manage IDistroSeriesLanguage
+ Distribution managers can also manage IDistroSeriesLanguage
         """
         return (AdminDistroSeriesTranslations(
             self.obj.distroseries).checkAuthenticated(user))

=== modified file 'lib/canonical/launchpad/testing/pages.py'
--- lib/canonical/launchpad/testing/pages.py 2009-12-18 13:25:19 +0000
+++ lib/canonical/launchpad/testing/pages.py 2009-12-21 17:17:46 +0000
@@ -39,6 +39,7 @@
 from lazr.restful.testing.webservice import WebServiceCaller
 from lp.testing import ANONYMOUS, login, login_person, logout
 from lp.testing.factory import LaunchpadObjectFactory
+from lp.registry.interfaces.person import NameAlreadyTaken

 class UnstickyCookieHTTPCaller(HTTPCaller):
@@ -636,17 +637,24 @@
     return LaunchpadWebServiceCaller(consumer_key, access_token.key)

-def setupUTCBrowser():
- """Testbrowser configured for Ubuntu Translations Coordinators."""
+def setupDTCBrowser():
+ """Testbrowser configured for Distribution Translations Coordinators.

+ Ubuntu is the configured distribution.
+ """
     login('<email address hidden>')
- utg_member = LaunchpadObjectFactory().makePerson(
- <email address hidden>", password="test")
- utg = LaunchpadObjectFactory().makeTranslationGroup(owner=utg_member)
- ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
- ubuntu.translationgroup = utg
+ try:
+ dtg_member = LaunchpadObjectFactory().makePerson(
+ <email address hidden>", password="test")
+ except NameAlreadyTaken:
+ # We have already created the translations coordinator
+ pass
+ else:
+ dtg = LaunchpadObjectFactory().makeTranslationGroup(owner=dtg_member)
+ ubuntu = getUtility(ILaunchpadCelebrities).ubuntu
+ ubuntu.translationgroup = dtg
     logout()
- return setupBrowser(auth='Basic <email address hidden>:test')
+ return setupBrowser(auth='Basic <email address hidden>:test')

 def stop():
@@ -669,7 +677,7 @@
     test.globs['user_webservice'] = LaunchpadWebServiceCaller(
         'launchpad-library', 'nopriv-read-nonprivate')
     test.globs['setupBrowser'] = setupBrowser
- test.globs['setupUTCBrowser'] = setupUTCBrowser
+ test.globs['setupDTCBrowser'] = setupDTCBrowser
     test.globs['browser'] = setupBrowser()
     test.globs['anon_browser'] = setupBrowser()
     test.globs['user_browser'] = setupBrowser(

=== modified file 'lib/lp/translations/stories/distroseries/xx-distroseries-translations.txt'
--- lib/lp/translations/stories/distroseries/xx-distroseries-translations.txt 2009-12-18 13:25:19 +0000
+++ lib/lp/translations/stories/distroseries/xx-distroseries-translations.txt 2009-12-21 17:17:38 +0000
@@ -45,24 +45,24 @@

 ... but the link is available to administrators:

- >>> utc_browser = setupUTCBrowser()
-
- >>> utc_browser.open('http://translations.launchpad.dev/ubuntu/hoary')
-
- >>> utc_browser.getLink('Change settings').click()
+ >>> dtc_browser = setupDTCBrowser()
+
+ >>> dtc_browser.open('http://translations.launchpad.dev/ubuntu/hoary')
+
+ >>> dtc_browser.getLink('Change settings').click()

 Once the administrator hides all translations...

- >>> utc_browser.getControl(
+ >>> dtc_browser.getControl(
     ... 'Hide translations for this release').selected = True
- >>> utc_browser.getControl('Change').click()
- >>> print utc_browser.url
+ >>> dtc_browser.getControl('Change').click()
+ >>> print dtc_browser.url
     http://translations.launchpad.dev/ubuntu/hoary

 ...a notice about the fact shows up on the overview page.

     >>> notices = find_tags_by_class(
- ... utc_browser.contents, 'visibility-notice')
+ ... dtc_browser.contents, 'visibility-notice')
     >>> for notice in notices:
     ... print extract_text(notice)
     Translations for this series are currently hidden.
@@ -92,7 +92,7 @@

 Translations administrator have access series with hidden translations.

- >>> utc_browser.open(
+ >>> dtc_browser.open(
     ... 'http://translations.launchpad.dev/ubuntu/hoary/+lang/es')

 Non existing languages are not viewable. English is a special case
@@ -124,7 +124,7 @@
 However, source package translations are still available to the
 administrators.

- >>> utc_browser.open(
+ >>> dtc_browser.open(
     ... 'http://translations.launchpad.dev/ubuntu/hoary/'
     ... '+sources/evolution')

@@ -132,21 +132,21 @@
 distribution should be deferred. That option is set also from the same
 form where we hide all translations and an admin is able to change it:

- >>> utc_browser.open('http://translations.launchpad.dev/ubuntu/hoary')
- >>> utc_browser.getLink('Change settings').click()
- >>> utc_browser.getControl(
+ >>> dtc_browser.open('http://translations.launchpad.dev/ubuntu/hoary')
+ >>> dtc_browser.getLink('Change settings').click()
+ >>> dtc_browser.getControl(
     ... 'Defer translation imports').selected
     False
- >>> utc_browser.getControl(
+ >>> dtc_browser.getControl(
     ... 'Defer translation imports').selected = True
- >>> utc_browser.getControl('Change').click()
- >>> print utc_browser.url
+ >>> dtc_browser.getControl('Change').click()
+ >>> print dtc_browser.url
     http://translations.launchpad.dev/ubuntu/hoary

 Once the system accepts the submission, we can see such change applied.

- >>> utc_browser.getLink('Change settings').click()
- >>> utc_browser.getControl(
+ >>> dtc_browser.getLink('Change settings').click()
+ >>> dtc_browser.getControl(
     ... 'Defer translation imports').selected
     True

« Back to merge proposal