Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(852)

Unified Diff: grit/format/policy_templates/writers/template_writer.py

Issue 544113002: Add optional mandatory policy setting for template generation (Closed) Base URL: https://chromium.googlesource.com/external/grit-i18n.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: grit/format/policy_templates/writers/template_writer.py
diff --git a/grit/format/policy_templates/writers/template_writer.py b/grit/format/policy_templates/writers/template_writer.py
index 2a8b548b193bb84e552e3c326a55917d48c5adc6..219fe40797824e62f874005bdd4a46cd15e24b98 100644
--- a/grit/format/policy_templates/writers/template_writer.py
+++ b/grit/format/policy_templates/writers/template_writer.py
@@ -87,6 +87,10 @@ class TemplateWriter(object):
'''Checks if the given policy can be recommended.'''
return policy.get('features', {}).get('can_be_recommended', False)
+ def CanBeMandatory(self, policy):
+ '''Checks if the given policy can be mandatory.'''
+ return policy.get('features', {}).get('can_be_mandatory', True)
Joao da Silva 2014/09/05 14:55:04 The default dict for 'features' must contain 'can_
+
def IsPolicySupportedOnPlatform(self, policy, platform):
'''Checks if |policy| is supported on |platform|.
@@ -155,7 +159,8 @@ class TemplateWriter(object):
self.WriteRecommendedPolicy(child_policy)
self.EndRecommendedPolicyGroup()
elif self.IsPolicySupported(policy):
- self.WritePolicy(policy)
+ if self.CanBeMandatory(policy):
+ self.WritePolicy(policy)
if self.CanBeRecommended(policy):
self.WriteRecommendedPolicy(policy)
self.EndTemplate()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698