Code review comment for lp:~henninge/launchpad/devel-737422-remove-translationsharinginfo
- devel-737422-remove-translationsharinginfo
- Merge into devel
Revision history for this message
Henning Eggers (henninge) wrote : | # |
1 | === modified file 'lib/lp/registry/model/distribution.py' |
2 | --- lib/lp/registry/model/distribution.py 2011-03-21 09:56:49 +0000 |
3 | +++ lib/lp/registry/model/distribution.py 2011-03-21 16:03:36 +0000 |
4 | @@ -1822,7 +1822,13 @@ |
5 | assert sourcepackage is not None, ( |
6 | "Translations sharing policy requires a SourcePackage.") |
7 | |
8 | - if not sourcepackage.productseries.has_current_translation_templates: |
9 | + has_upstream_translations = False |
10 | + productseries = sourcepackage.productseries |
11 | + if productseries is not None: |
12 | + collection = productseries.getTemplatesCollection() |
13 | + has_upstream_translations = bool( |
14 | + collection.restrictCurrent().select().any()) |
15 | + if productseries is None or not has_upstream_translations: |
16 | # There is no known upstream template or series. Take the |
17 | # uploader's word for whether these are upstream translations |
18 | # (in which case they're shared) or not. |
19 | |
20 | === modified file 'lib/lp/translations/browser/productseries.py' |
21 | --- lib/lp/translations/browser/productseries.py 2011-03-18 17:12:56 +0000 |
22 | +++ lib/lp/translations/browser/productseries.py 2011-03-21 15:07:49 +0000 |
23 | @@ -459,7 +459,7 @@ |
24 | sourcepackage = self.context.getUbuntuTranslationFocusPackage() |
25 | if sourcepackage is None: |
26 | return False |
27 | - collection = sourcepackage.getTemplateCollection().restrictCurrent() |
28 | + collection = sourcepackage.getTemplatesCollection().restrictCurrent() |
29 | return bool(collection.select().any()) |
30 | |
31 | @property |
32 | |
33 | === modified file 'lib/lp/translations/browser/sourcepackage.py' |
34 | --- lib/lp/translations/browser/sourcepackage.py 2011-03-18 17:12:56 +0000 |
35 | +++ lib/lp/translations/browser/sourcepackage.py 2011-03-21 15:11:01 +0000 |
36 | @@ -58,7 +58,7 @@ |
37 | productseries = self.context.productseries |
38 | if productseries is None: |
39 | return False |
40 | - collection = productseries.getTemplateCollection().restrictCurrent() |
41 | + collection = productseries.getTemplatesCollection().restrictCurrent() |
42 | return bool(collection.select().any()) |
43 | |
44 | @property |
45 | @@ -123,7 +123,7 @@ |
46 | productseries = self.context.productseries |
47 | if productseries is None: |
48 | return False |
49 | - collection = productseries.getTemplateCollection().restrictCurrent() |
50 | + collection = productseries.getTemplatesCollection().restrictCurrent() |
51 | return bool(collection.select().any()) |
52 | |
53 | def initialize(self): |
54 | |
55 | === modified file 'lib/lp/translations/utilities/translation_import.py' |
56 | --- lib/lp/translations/utilities/translation_import.py 2011-03-18 17:12:56 +0000 |
57 | +++ lib/lp/translations/utilities/translation_import.py 2011-03-21 15:09:50 +0000 |
58 | @@ -447,7 +447,7 @@ |
59 | productseries = sourcepackage.productseries |
60 | if productseries is None: |
61 | return True |
62 | - collection = productseries.getTemplateCollection().restrictCurrent() |
63 | + collection = productseries.getTemplatesCollection().restrictCurrent() |
64 | return not bool(collection.select().any()) |
65 | |
66 | @cachedproperty |
Thanks! Unfortunately the branch has a design flaw that causes a lot of latesCollection is not
"Forbidden Attribute" errors in tests. TranslationTemp
security aware (no interface, not in configure.zcml) because it is only used
inside the model classes.
The next branch will fix this anyway and therefore I won't fix this here and
not land this branch.