Merge lp:~adiroiban/launchpad/bug-193750 into lp:launchpad

Proposed by Adi Roiban
Status: Merged
Approved by: Henning Eggers
Approved revision: not available
Merge reported by: Adi Roiban
Merged at revision: not available
Proposed branch: lp:~adiroiban/launchpad/bug-193750
Merge into: lp:launchpad
Diff against target: 194 lines (+85/-11)
3 files modified
lib/lp/translations/browser/language.py (+8/-0)
lib/lp/translations/stories/standalone/xx-language.txt (+68/-7)
lib/lp/translations/templates/language-index.pt (+9/-4)
To merge this branch: bzr merge lp:~adiroiban/launchpad/bug-193750
Reviewer Review Type Date Requested Status
Abel Deuring (community) code Approve
Review via email: mp+15292@code.launchpad.net

Commit message

Update the links for adding a question for Rosetta from addticket to addquestion. Make them use the answers.lp.net domain name.

To post a comment you must log in.
Revision history for this message
Adi Roiban (adiroiban) wrote :

= Bug 193750 =

== Proposed fix ==

The fix should replace "ticket" to "question" and update the required answer links for addticket to addquestions.

Also instead on translations.lp.dev/rosetta/addticket the url was replaces to answers.lp.dev/rosetta/addquestion to have a clean namespace

== Implementation details ==

There were no test for checking the cases when those links should appear so I have added the required pagetests.

The translate.txt pagetest was also structured... but a bit.

== Tests ==

./bin/test -ct language

== Demo and Q/A ==

Abkhazian is a language that has no information about plural forms and is not registered as being spoken in any country.

We will see a note about missing plural forms and a link to Rosetta
add question page for informing Rosetta admin about the right plural form.

    >>> browser.open('http://translations.launchpad.dev/+languages/ab')
    >>> print extract_text(find_portlet(browser.contents, 'Plural forms'
    ... ).renderContents())
    Plural forms
    Unfortunately, Launchpad doesn't know the plural
    form information for this language...

    >>> print browser.getLink(id='plural_question').url
    http://answers.launchpad.dev/rosetta/+addquestion

We will see a note that this language is not registred as being spoken in any
country and a link to add question page for informating Rosetta admin about the
countries where this page is officially spoken.

    >>> countries_portlet = find_portlet(browser.contents, 'Countries')
    >>> print countries_portlet
    <...
    Abkhazian is not registered as being spoken in any
    country...

    >>> print browser.getLink(id='country_question').url
    http://answers.launchpad.dev/rosetta/+addquestion

== lint ==

Checking for conflicts. and issues in doctests and templates.
Running jslint, xmllint, pyflakes, and pylint.
Using normal rules.

Linting changed files:
  lib/lp/translations/browser/language.py
  lib/lp/translations/stories/standalone/xx-language.txt
  lib/lp/translations/templates/language-index.pt

Revision history for this message
Abel Deuring (adeuring) wrote :
Download full text (9.1 KiB)

Hi Adi,

a very nice branch! I have only a number of mostly formal nitpicks,
see below.

When you have fixed these small issues, I'll ec2-test the branch and
land it on your behalf.

Abel

>
> = Bug 193750 =
>
> == Proposed fix ==
>
> The fix should replace "ticket" to "question" and update the required answer links for addticket to addquestions.
>
> Also instead on translations.lp.dev/rosetta/addticket the url was replaces to answers.lp.dev/rosetta/addquestion to have a clean namespace
>
> == Implementation details ==
>
> There were no test for checking the cases when those links should appear so I have added the required pagetests.

Thanks for adding them!

>
> The translate.txt pagetest was also structured... but a bit.
>
> == Tests ==
>
> ./bin/test -ct language
>
> == Demo and Q/A ==
>
> Abkhazian is a language that has no information about plural forms and is not registered as being spoken in any country.
>
> We will see a note about missing plural forms and a link to Rosetta
> add question page for informing Rosetta admin about the right plural form.
>
> >>> browser.open('http://translations.launchpad.dev/+languages/ab')
> >>> print extract_text(find_portlet(browser.contents, 'Plural forms'
> ... ).renderContents())
> Plural forms
> Unfortunately, Launchpad doesn't know the plural
> form information for this language...
>
> >>> print browser.getLink(id='plural_question').url
> http://answers.launchpad.dev/rosetta/+addquestion
>
> We will see a note that this language is not registred as being spoken in any
> country and a link to add question page for informating Rosetta admin about the
> countries where this page is officially spoken.
>
> >>> countries_portlet = find_portlet(browser.contents, 'Countries')
> >>> print countries_portlet
> <...
> Abkhazian is not registered as being spoken in any
> country...
>
> >>> print browser.getLink(id='country_question').url
> http://answers.launchpad.dev/rosetta/+addquestion
>
> == lint ==
>
> Checking for conflicts. and issues in doctests and templates.
> Running jslint, xmllint, pyflakes, and pylint.
> Using normal rules.
>
> Linting changed files:
> lib/lp/translations/browser/language.py
> lib/lp/translations/stories/standalone/xx-language.txt
> lib/lp/translations/templates/language-index.pt
>
>
> === modified file 'lib/lp/translations/browser/language.py'
> --- lib/lp/translations/browser/language.py 2009-10-31 11:06:44 +0000
> +++ lib/lp/translations/browser/language.py 2009-11-26 19:30:28 +0000
> @@ -29,6 +29,7 @@
> enabled_with_permission, GetitemNavigation, LaunchpadEditFormView,
> LaunchpadFormView, LaunchpadView, Link, NavigationMenu)
> from lp.translations.utilities.pluralforms import make_friendly_plural_forms
> +from lp.registry.interfaces.product import IProductSet
>
> from canonical.widgets import LabeledMultiCheckBoxWidget
>
> @@ -202,6 +203,13 @@
>
> return pluralforms_list
>
> + @property
> + def add_question_url(self):
> + rosetta = getUtility(IProductSet).getByName('rosetta')

Here you use the rosetta project not as an ordinary project that can
be replaced by any other pro...

Read more...

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

Thanks for the review.
I have done the required changes.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/translations/browser/language.py'
2--- lib/lp/translations/browser/language.py 2009-10-31 11:06:44 +0000
3+++ lib/lp/translations/browser/language.py 2009-12-07 08:16:13 +0000
4@@ -29,6 +29,7 @@
5 enabled_with_permission, GetitemNavigation, LaunchpadEditFormView,
6 LaunchpadFormView, LaunchpadView, Link, NavigationMenu)
7 from lp.translations.utilities.pluralforms import make_friendly_plural_forms
8+from canonical.launchpad.interfaces.launchpad import ILaunchpadCelebrities
9
10 from canonical.widgets import LabeledMultiCheckBoxWidget
11
12@@ -202,6 +203,13 @@
13
14 return pluralforms_list
15
16+ @property
17+ def add_question_url(self):
18+ rosetta = getUtility(ILaunchpadCelebrities).lp_translations
19+ return canonical_url(
20+ rosetta,
21+ view_name='+addquestion',
22+ rootsite='answers')
23
24 class LanguageAdminView(LaunchpadEditFormView):
25 """Handle an admin form submission."""
26
27=== modified file 'lib/lp/translations/stories/standalone/xx-language.txt'
28--- lib/lp/translations/stories/standalone/xx-language.txt 2009-10-31 11:06:44 +0000
29+++ lib/lp/translations/stories/standalone/xx-language.txt 2009-12-07 08:16:13 +0000
30@@ -1,6 +1,15 @@
31+
32+
33+Languages view
34+==============
35+
36 Here is the tale of languages. We will see how to create, find and edit
37 them.
38
39+
40+Getting there
41+-------------
42+
43 Launchpad Translations has a main page.
44
45 >>> admin_browser.open('http://translations.launchpad.dev/')
46@@ -11,7 +20,12 @@
47 >>> print admin_browser.url
48 http://translations.launchpad.dev/+languages
49
50-Following the link, there is a form to add new languages.
51+
52+Adding new languages
53+--------------------
54+
55+Following the link from the translations main page, there is a form to
56+add new languages.
57
58 >>> admin_browser.getLink('Add new language').click()
59 >>> print admin_browser.url
60@@ -65,11 +79,16 @@
61 ...
62 LinkNotFoundError
63
64- >>> user_browser.open('http://translations.launchpad.dev/+languages/+add')
65+ >>> user_browser.open(
66+ ... 'http://translations.launchpad.dev/+languages/+add')
67 Traceback (most recent call last):
68 ...
69 Unauthorized:...
70
71+
72+Searching for a language
73+------------------------
74+
75 From the top languages page, anyone can find languages.
76
77 >>> browser.open('http://translations.launchpad.dev/+languages')
78@@ -82,7 +101,11 @@
79 >>> print browser.url
80 http://translations.launchpad.dev/+languages/+index?find=Spanish
81
82-And following one of the found languages, we can see a brief information
83+
84+Read language information
85+-------------------------
86+
87+Following one of the found languages, we can see a brief information
88 about the selected language.
89
90 >>> browser.getLink('Spanish').click()
91@@ -128,14 +151,50 @@
92 ...Uruguay...
93 ...Venezuela...
94
95- >>> topcontributors_portlet = find_portlet(browser.contents, 'Top contributors')
96+ >>> topcontributors_portlet = find_portlet(
97+ ... browser.contents, 'Top contributors')
98 >>> print topcontributors_portlet
99 <...
100 ...Carlos Perelló Marín...
101
102+Our test sample data does not know about plural forms of
103+Abkhazian and about countries where this language is spoken.
104+
105+We will see a note about missing plural forms and a link to Rosetta
106+add question page for informing Rosetta admin about the right plural
107+form.
108+
109+ >>> browser.open('http://translations.launchpad.dev/+languages/ab')
110+ >>> print extract_text(find_portlet(browser.contents, 'Plural forms'
111+ ... ).renderContents())
112+ Plural forms
113+ Unfortunately, Launchpad doesn't know the plural
114+ form information for this language...
115+
116+ >>> print browser.getLink(id='plural_question').url
117+ http://answers.launchpad.dev/rosetta/+addquestion
118+
119+We will see a note that Launchpad does not know in which countries
120+this language is spoken and a link to add question page for informing
121+Rosetta admin about the countries where this page is officially spoken.
122+
123+ >>> countries_portlet = find_portlet(browser.contents, 'Countries')
124+ >>> print countries_portlet
125+ <...
126+ Abkhazian is not registered as being spoken in any
127+ country...
128+
129+ >>> print browser.getLink(id='country_question').url
130+ http://answers.launchpad.dev/rosetta/+addquestion
131+
132+
133+Edit language information
134+-------------------------
135+
136 Finally, there is the edit form to change language basic information.
137
138- >>> user_browser.open('http://translations.launchpad.dev/+languages/es')
139+ >>> user_browser.open(
140+ ... 'http://translations.launchpad.dev/+languages/es')
141 >>> print user_browser.url
142 http://translations.launchpad.dev/+languages/es
143
144@@ -146,7 +205,8 @@
145 ...
146 LinkNotFoundError
147
148- >>> user_browser.open('http://translations.launchpad.dev/+languages/es/+admin')
149+ >>> user_browser.open(
150+ ... 'http://translations.launchpad.dev/+languages/es/+admin')
151 Traceback (most recent call last):
152 ...
153 Unauthorized:...
154@@ -155,7 +215,8 @@
155
156 >>> from canonical.launchpad.testing.pages import strip_label
157
158- >>> admin_browser.open('http://translations.launchpad.dev/+languages/es')
159+ >>> admin_browser.open(
160+ ... 'http://translations.launchpad.dev/+languages/es')
161 >>> print admin_browser.url
162 http://translations.launchpad.dev/+languages/es
163
164
165=== modified file 'lib/lp/translations/templates/language-index.pt'
166--- lib/lp/translations/templates/language-index.pt 2009-09-17 14:45:59 +0000
167+++ lib/lp/translations/templates/language-index.pt 2009-12-07 08:16:13 +0000
168@@ -43,8 +43,10 @@
169 <p class="helpwanted">
170 Unfortunately, Launchpad doesn't know the plural form
171 information for this language. If you know it, please open a
172- <a href="/rosetta/+addticket">ticket</a> with that information,
173- so we can add it to Launchpad.
174+ <a id='plural_question'
175+ tal:attributes="href view/add_question_url"
176+ >question</a>
177+ with that information, so we can add it to Launchpad.
178 </p>
179 </tal:has_not_pluralforms>
180 </div>
181@@ -124,8 +126,11 @@
182 </tal:language>
183 is not registered as being spoken in any country. If you know
184 about a country that officially speaks this language, please
185- open a <a href="/rosetta/+addticket">ticket</a> with that
186- information, so we can add it to Launchpad.
187+ open a
188+ <a id='country_question'
189+ tal:attributes="href view/add_question_url"
190+ >question</a>
191+ with that information, so we can add it to Launchpad.
192 </p>
193 </tal:has_not_countries>
194 </div>