OLD | NEW |
---|---|
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 Loading... | |
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) |
OLD | NEW |