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

Side by Side Diff: tools/grit/grit/format/policy_templates/writers/reg_writer.py

Issue 6176005: Support int-typed policies in policy template generator (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 5
6 from xml.dom import minidom 6 from xml.dom import minidom
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 def GetWriter(config, messages): 10 def GetWriter(config, messages):
11 '''Factory method for creating RegWriter objects. 11 '''Factory method for creating RegWriter objects.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 else: 49 else:
50 self._StartBlock(None) 50 self._StartBlock(None)
51 if policy['type'] == 'string': 51 if policy['type'] == 'string':
52 escaped_str = self._EscapeRegString(example_value) 52 escaped_str = self._EscapeRegString(example_value)
53 example_value_str = '"' + escaped_str + '"' 53 example_value_str = '"' + escaped_str + '"'
54 elif policy['type'] == 'main': 54 elif policy['type'] == 'main':
55 if example_value == True: 55 if example_value == True:
56 example_value_str = 'dword:1' 56 example_value_str = 'dword:1'
57 else: 57 else:
58 example_value_str = 'dword:0' 58 example_value_str = 'dword:0'
59 elif policy['type'] == 'int-enum': 59 elif policy['type'] in ('int', 'int-enum'):
60 example_value_str = 'dword:%d' % example_value 60 example_value_str = 'dword:%d' % example_value
gfeher 2011/01/10 20:56:33 While you are here, please change the base of the
Jakob Kummerow 2011/01/11 08:47:28 Done.
61 elif policy['type'] == 'string-enum': 61 elif policy['type'] == 'string-enum':
62 example_value_str = '"%s"' % example_value 62 example_value_str = '"%s"' % example_value
63 else: 63 else:
64 raise Exception('unknown policy type %s:' % policy['type']) 64 raise Exception('unknown policy type %s:' % policy['type'])
65 65
66 self._out.append('"%s"=%s' % (policy['name'], example_value_str)) 66 self._out.append('"%s"=%s' % (policy['name'], example_value_str))
67 67
68 def BeginTemplate(self): 68 def BeginTemplate(self):
69 pass 69 pass
70 70
71 def EndTemplate(self): 71 def EndTemplate(self):
72 pass 72 pass
73 73
74 def Init(self): 74 def Init(self):
75 self._out = ['Windows Registry Editor Version 5.00'] 75 self._out = ['Windows Registry Editor Version 5.00']
76 self._last_key = None 76 self._last_key = None
77 77
78 def GetTemplateText(self): 78 def GetTemplateText(self):
79 return self.NEWLINE.join(self._out) 79 return self.NEWLINE.join(self._out)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698