Merge lp:~jtv/launchpad/pre-export-cleanup into lp:launchpad

Proposed by Jeroen T. Vermeulen
Status: Merged
Approved by: Leonard Richardson
Approved revision: no longer in the source branch.
Merged at revision: 11180
Proposed branch: lp:~jtv/launchpad/pre-export-cleanup
Merge into: lp:launchpad
Diff against target: 141 lines (+15/-17)
2 files modified
lib/lp/translations/model/pofile.py (+13/-14)
lib/lp/translations/model/potemplate.py (+2/-3)
To merge this branch: bzr merge lp:~jtv/launchpad/pre-export-cleanup
Reviewer Review Type Date Requested Status
Leonard Richardson (community) code Approve
Review via email: mp+30445@code.launchpad.net

Commit message

POFile/POTemplate lint cleanup.

Description of the change

Just cleaning up a bit of lint so it doesn't pollute a more serious branch I have in progress. No tests affected etc.

Jeroen

To post a comment you must log in.
Revision history for this message
Leonard Richardson (leonardr) wrote :

+1

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/translations/model/pofile.py'
2--- lib/lp/translations/model/pofile.py 2010-04-23 14:46:43 +0000
3+++ lib/lp/translations/model/pofile.py 2010-07-20 18:22:42 +0000
4@@ -1,4 +1,4 @@
5-# Copyright 2009 Canonical Ltd. This software is licensed under the
6+# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
7 # GNU Affero General Public License version 3 (see the file LICENSE).
8
9 # pylint: disable-msg=E0611,W0212,W0231
10@@ -17,8 +17,7 @@
11 import datetime
12 import pytz
13 from sqlobject import (
14- ForeignKey, IntCol, StringCol, BoolCol, SQLMultipleJoin
15- )
16+ ForeignKey, IntCol, StringCol, BoolCol, SQLMultipleJoin)
17 from zope.interface import implements
18 from zope.component import getAdapter, getUtility
19 from zope.security.proxy import removeSecurityProxy
20@@ -132,6 +131,7 @@
21 else:
22 return False
23
24+
25 def _can_edit_translations(pofile, person):
26 """Say if a person is able to edit existing translations.
27
28@@ -182,6 +182,7 @@
29 translators,
30 person) or person.inTeam(pofile.owner)
31
32+
33 def _can_add_suggestions(pofile, person):
34 """Whether a person is able to add suggestions.
35
36@@ -316,7 +317,6 @@
37 text=quote_like(text))
38 return translation_match
39
40-
41 def _getTemplateSearchQuery(self, text):
42 """Query for finding `text` in msgids of this POFile.
43 """
44@@ -570,7 +570,7 @@
45 return u','.join(emails)
46 elif credits_type == TranslationCreditsType.KDE_NAMES:
47 names = []
48-
49+
50 if text is not None:
51 if text == u'':
52 text = SPACE
53@@ -593,7 +593,7 @@
54 text = text[:header_index]
55 else:
56 text += u'\n\n'
57-
58+
59 text += LP_CREDIT_HEADER
60 for contributor in self.contributors:
61 text += ("\n %s %s" %
62@@ -711,7 +711,6 @@
63 clause_tables.insert(0, POTMsgSet)
64 return self._getOrderedPOTMsgSets(clause_tables, query)
65
66-
67 def getPOTMsgSetUntranslated(self):
68 """See `IPOFile`."""
69 # We get all POTMsgSet.ids with translations, and later
70@@ -747,12 +746,12 @@
71 def getPOTMsgSetWithNewSuggestions(self):
72 """See `IPOFile`."""
73 clauses = self._getClausesForPOFileMessages()
74- msgstr_clause = make_plurals_sql_fragment(
75+ msgstr_clause = make_plurals_sql_fragment(
76 "TranslationMessage.msgstr%(form)d IS NOT NULL", "OR")
77 clauses.extend([
78 'TranslationTemplateItem.potmsgset = POTMsgSet.id',
79 'TranslationMessage.is_current IS NOT TRUE',
80- "(%s)" % msgstr_clause
81+ "(%s)" % msgstr_clause,
82 ])
83
84 variant_clause = self._getLanguageVariantClause(table='diverged')
85@@ -908,12 +907,12 @@
86 conditions.
87 """
88 query.append('%(table_name)s.msgstr0 IS NOT NULL' % {
89- 'table_name' : table_name})
90+ 'table_name': table_name})
91 if self.language.pluralforms > 1:
92 plurals_query = ' AND '.join(
93 '%(table_name)s.msgstr%(plural_form)d IS NOT NULL' % {
94- 'plural_form' : plural_form,
95- 'table_name' : table_name
96+ 'plural_form': plural_form,
97+ 'table_name': table_name,
98 } for plural_form in range(1, self.plural_forms))
99 query.append(
100 '(POTMsgSet.msgid_plural IS NULL OR (%s))' % plurals_query)
101@@ -1329,7 +1328,7 @@
102 self.fuzzyheader = False
103 self.lasttranslator = None
104 UTC = pytz.timezone('UTC')
105- self.date_changed = None
106+ self.date_changed = None
107 self.lastparsed = None
108 self.owner = getUtility(ILaunchpadCelebrities).rosetta_experts
109
110@@ -1663,7 +1662,7 @@
111 And(MatchingPOT.productseriesID is not None,
112 OtherPOT.productseriesID is not None,
113 (MatchingProductSeries.productID ==
114- OtherProductSeries.productID)) )))
115+ OtherProductSeries.productID)))))
116 results.config(distinct=True)
117 return results
118
119
120=== modified file 'lib/lp/translations/model/potemplate.py'
121--- lib/lp/translations/model/potemplate.py 2010-07-20 12:33:43 +0000
122+++ lib/lp/translations/model/potemplate.py 2010-07-20 18:22:42 +0000
123@@ -461,8 +461,7 @@
124 "POFile.potemplate = %d AND "
125 "POFile.variant IS NULL" % self.id,
126 clauseTables=['POFile', 'Language'],
127- distinct=True,
128- )
129+ distinct=True)
130
131 def getPOFileByPath(self, path):
132 """See `IPOTemplate`."""
133@@ -573,7 +572,7 @@
134 product = self.productseries.product
135 clauses.extend([
136 'POTemplate.productseries=ProductSeries.id',
137- 'ProductSeries.product %s' % self._null_quote(product)
138+ 'ProductSeries.product %s' % self._null_quote(product),
139 ])
140 clause_tables.append('ProductSeries')
141 elif self.distroseries is not None: