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

Unified Diff: grit/format/policy_templates/writers/doc_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: rebase 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
Index: grit/format/policy_templates/writers/doc_writer.py
diff --git a/grit/format/policy_templates/writers/doc_writer.py b/grit/format/policy_templates/writers/doc_writer.py
index 62c762f1cbd962bbf93a37761c56231fbd9f9521..d8f108d27eaaaf257a1ef61940db7c52d0f627f2 100644
--- a/grit/format/policy_templates/writers/doc_writer.py
+++ b/grit/format/policy_templates/writers/doc_writer.py
@@ -180,7 +180,10 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter):
win = self._AddStyledElement(parent, 'dd', ['.monospace', '.pre'])
win_text = []
cnt = 1
- key_name = self.config['win_reg_mandatory_key_name']
+ if self.CanBeRecommended(policy) and not self.CanBeMandatory(policy):
+ key_name = self.config['win_reg_recommended_key_name']
+ else:
+ key_name = self.config['win_reg_mandatory_key_name']
for item in example_value:
win_text.append(
'%s\\%s\\%d = "%s"' %
@@ -287,7 +290,10 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter):
'''
self.AddElement(parent, 'dt', {}, 'Windows:')
win = self._AddStyledElement(parent, 'dd', ['.monospace', '.pre'])
- key_name = self.config['win_reg_mandatory_key_name']
+ if self.CanBeRecommended(policy) and not self.CanBeMandatory(policy):
+ key_name = self.config['win_reg_recommended_key_name']
+ else:
+ key_name = self.config['win_reg_mandatory_key_name']
example = json.dumps(policy['example_value'])
self.AddText(win, '%s\\%s = %s' % (key_name, policy['name'], example))
@@ -459,10 +465,14 @@ class DocWriter(xml_formatted_writer.XMLFormattedWriter):
if policy['type'] != 'external':
# All types except 'external' can be set through platform policy.
if self.IsPolicySupportedOnPlatform(policy, 'win'):
+ if self.CanBeRecommended(policy) and not self.CanBeMandatory(policy):
+ key_name = self.config['win_reg_recommended_key_name']
+ else:
+ key_name = self.config['win_reg_mandatory_key_name']
self._AddPolicyAttribute(
dl,
'win_reg_loc',
- self.config['win_reg_mandatory_key_name'] + '\\' + policy['name'],
+ key_name + '\\' + policy['name'],
['.monospace'])
if (self.IsPolicySupportedOnPlatform(policy, 'linux') or
self.IsPolicySupportedOnPlatform(policy, 'mac')):

Powered by Google App Engine
This is Rietveld 408576698