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

Side by Side Diff: grit/format/policy_templates/writers/adm_writer.py

Issue 550163002: Add optional mandatory policy setting for template generation (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 6
7 from grit.format.policy_templates.writers import template_writer 7 from grit.format.policy_templates.writers import template_writer
8 8
9 9
10 NEWLINE = '\r\n' 10 NEWLINE = '\r\n'
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 builder.AddLine('VALUENAME "%s"' % policy['name']) 146 builder.AddLine('VALUENAME "%s"' % policy['name'])
147 builder.AddLine('VALUEON NUMERIC 1') 147 builder.AddLine('VALUEON NUMERIC 1')
148 builder.AddLine('VALUEOFF NUMERIC 0') 148 builder.AddLine('VALUEOFF NUMERIC 0')
149 else: 149 else:
150 self._WritePart(policy, key_name, builder) 150 self._WritePart(policy, key_name, builder)
151 151
152 builder.AddLine('END POLICY', -1) 152 builder.AddLine('END POLICY', -1)
153 builder.AddLine() 153 builder.AddLine()
154 154
155 def WritePolicy(self, policy): 155 def WritePolicy(self, policy):
156 self._WritePolicy(policy, 156 if self.CanBeMandatory(policy):
157 self.config['win_reg_mandatory_key_name'], 157 self._WritePolicy(policy,
158 self.policies) 158 self.config['win_reg_mandatory_key_name'],
159 self.policies)
159 160
160 def WriteRecommendedPolicy(self, policy): 161 def WriteRecommendedPolicy(self, policy):
161 self._WritePolicy(policy, 162 self._WritePolicy(policy,
162 self.config['win_reg_recommended_key_name'], 163 self.config['win_reg_recommended_key_name'],
163 self.recommended_policies) 164 self.recommended_policies)
164 165
165 def BeginPolicyGroup(self, group): 166 def BeginPolicyGroup(self, group):
166 category_name = group['name'] + '_Category' 167 category_name = group['name'] + '_Category'
167 self._AddGuiString(category_name, group['caption']) 168 self._AddGuiString(category_name, group['caption'])
168 self.policies.AddLine('CATEGORY !!' + category_name, 1) 169 self.policies.AddLine('CATEGORY !!' + category_name, 1)
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 self.strings = IndentedStringBuilder() 249 self.strings = IndentedStringBuilder()
249 # Map of strings seen, to avoid duplicates. 250 # Map of strings seen, to avoid duplicates.
250 self.strings_seen = {} 251 self.strings_seen = {}
251 # String buffer for building the policies of the ADM file. 252 # String buffer for building the policies of the ADM file.
252 self.policies = IndentedStringBuilder() 253 self.policies = IndentedStringBuilder()
253 # String buffer for building the recommended policies of the ADM file. 254 # String buffer for building the recommended policies of the ADM file.
254 self.recommended_policies = IndentedStringBuilder() 255 self.recommended_policies = IndentedStringBuilder()
255 256
256 def GetTemplateText(self): 257 def GetTemplateText(self):
257 return self.lines.ToString() 258 return self.lines.ToString()
OLDNEW
« no previous file with comments | « grit/format/policy_templates/writer_configuration.py ('k') | grit/format/policy_templates/writers/adm_writer_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698