| OLD | NEW |
| 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 import json | 7 import json |
| 8 from xml.dom import minidom | 8 from xml.dom import minidom |
| 9 from grit import lazy_re | 9 from grit import lazy_re |
| 10 from grit.format.policy_templates.writers import xml_formatted_writer | 10 from grit.format.policy_templates.writers import xml_formatted_writer |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 key_name = self.config['win_reg_recommended_key_name'] | 200 key_name = self.config['win_reg_recommended_key_name'] |
| 201 else: | 201 else: |
| 202 key_name = self.config['win_reg_mandatory_key_name'] | 202 key_name = self.config['win_reg_mandatory_key_name'] |
| 203 for item in example_value: | 203 for item in example_value: |
| 204 win_text.append( | 204 win_text.append( |
| 205 '%s\\%s\\%d = "%s"' % | 205 '%s\\%s\\%d = "%s"' % |
| 206 (key_name, policy['name'], cnt, item)) | 206 (key_name, policy['name'], cnt, item)) |
| 207 cnt = cnt + 1 | 207 cnt = cnt + 1 |
| 208 self.AddText(win, '\n'.join(win_text)) | 208 self.AddText(win, '\n'.join(win_text)) |
| 209 | 209 |
| 210 def _AddListExampleLinux(self, parent, policy): | 210 def _AddListExampleAndroidLinux(self, parent, policy): |
| 211 '''Adds an example value for Linux of a 'list' policy to a DOM node. | 211 '''Adds an example value for Android/Linux of a 'list' policy to a DOM node. |
| 212 | 212 |
| 213 Args: | 213 Args: |
| 214 parent: The DOM node for which the example will be added. | 214 parent: The DOM node for which the example will be added. |
| 215 policy: A policy of type 'list', for which the Linux example value | 215 policy: A policy of type 'list', for which the Android/Linux example value |
| 216 is generated. | 216 is generated. |
| 217 ''' | 217 ''' |
| 218 example_value = policy['example_value'] | 218 example_value = policy['example_value'] |
| 219 self.AddElement(parent, 'dt', {}, 'Linux:') | 219 self.AddElement(parent, 'dt', {}, 'Android/Linux:') |
| 220 linux = self._AddStyledElement(parent, 'dd', ['.monospace']) | 220 element = self._AddStyledElement(parent, 'dd', ['.monospace']) |
| 221 linux_text = [] | 221 text = [] |
| 222 for item in example_value: | 222 for item in example_value: |
| 223 linux_text.append('"%s"' % item) | 223 text.append('"%s"' % item) |
| 224 self.AddText(linux, '[%s]' % ', '.join(linux_text)) | 224 self.AddText(element, '[%s]' % ', '.join(text)) |
| 225 | 225 |
| 226 def _AddListExample(self, parent, policy): | 226 def _AddListExample(self, parent, policy): |
| 227 '''Adds the example value of a 'list' policy to a DOM node. Example output: | 227 '''Adds the example value of a 'list' policy to a DOM node. Example output: |
| 228 <dl> | 228 <dl> |
| 229 <dt>Windows:</dt> | 229 <dt>Windows:</dt> |
| 230 <dd> | 230 <dd> |
| 231 Software\Policies\Chromium\DisabledPlugins\0 = "Java" | 231 Software\Policies\Chromium\DisabledPlugins\0 = "Java" |
| 232 Software\Policies\Chromium\DisabledPlugins\1 = "Shockwave Flash" | 232 Software\Policies\Chromium\DisabledPlugins\1 = "Shockwave Flash" |
| 233 </dd> | 233 </dd> |
| 234 <dt>Linux:</dt> | 234 <dt>Android/Linux:</dt> |
| 235 <dd>["Java", "Shockwave Flash"]</dd> | 235 <dd>["Java", "Shockwave Flash"]</dd> |
| 236 <dt>Mac:</dt> | 236 <dt>Mac:</dt> |
| 237 <dd> | 237 <dd> |
| 238 <array> | 238 <array> |
| 239 <string>Java</string> | 239 <string>Java</string> |
| 240 <string>Shockwave Flash</string> | 240 <string>Shockwave Flash</string> |
| 241 </array> | 241 </array> |
| 242 </dd> | 242 </dd> |
| 243 </dl> | 243 </dl> |
| 244 | 244 |
| 245 Args: | 245 Args: |
| 246 parent: The DOM node for which the example will be added. | 246 parent: The DOM node for which the example will be added. |
| 247 policy: The data structure of a policy. | 247 policy: The data structure of a policy. |
| 248 ''' | 248 ''' |
| 249 examples = self._AddStyledElement(parent, 'dl', ['dd dl']) | 249 examples = self._AddStyledElement(parent, 'dl', ['dd dl']) |
| 250 if self.IsPolicySupportedOnPlatform(policy, 'win'): | 250 if self.IsPolicySupportedOnPlatform(policy, 'win'): |
| 251 self._AddListExampleWindows(examples, policy) | 251 self._AddListExampleWindows(examples, policy) |
| 252 if self.IsPolicySupportedOnPlatform(policy, 'linux'): | 252 if (self.IsPolicySupportedOnPlatform(policy, 'android') or |
| 253 self._AddListExampleLinux(examples, policy) | 253 self.IsPolicySupportedOnPlatform(policy, 'linux')): |
| 254 self._AddListExampleAndroidLinux(examples, policy) |
| 254 if self.IsPolicySupportedOnPlatform(policy, 'mac'): | 255 if self.IsPolicySupportedOnPlatform(policy, 'mac'): |
| 255 self._AddListExampleMac(examples, policy) | 256 self._AddListExampleMac(examples, policy) |
| 256 | 257 |
| 257 def _PythonObjectToPlist(self, obj, indent=''): | 258 def _PythonObjectToPlist(self, obj, indent=''): |
| 258 '''Converts a python object to an equivalent XML plist. | 259 '''Converts a python object to an equivalent XML plist. |
| 259 | 260 |
| 260 Returns a list of lines.''' | 261 Returns a list of lines.''' |
| 261 obj_type = type(obj) | 262 obj_type = type(obj) |
| 262 if obj_type == bool: | 263 if obj_type == bool: |
| 263 return [ '%s<%s/>' % (indent, 'true' if obj else 'false') ] | 264 return [ '%s<%s/>' % (indent, 'true' if obj else 'false') ] |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 ''' | 307 ''' |
| 307 self.AddElement(parent, 'dt', {}, 'Windows:') | 308 self.AddElement(parent, 'dt', {}, 'Windows:') |
| 308 win = self._AddStyledElement(parent, 'dd', ['.monospace', '.pre']) | 309 win = self._AddStyledElement(parent, 'dd', ['.monospace', '.pre']) |
| 309 if self.CanBeRecommended(policy) and not self.CanBeMandatory(policy): | 310 if self.CanBeRecommended(policy) and not self.CanBeMandatory(policy): |
| 310 key_name = self.config['win_reg_recommended_key_name'] | 311 key_name = self.config['win_reg_recommended_key_name'] |
| 311 else: | 312 else: |
| 312 key_name = self.config['win_reg_mandatory_key_name'] | 313 key_name = self.config['win_reg_mandatory_key_name'] |
| 313 example = json.dumps(policy['example_value']) | 314 example = json.dumps(policy['example_value']) |
| 314 self.AddText(win, '%s\\%s = %s' % (key_name, policy['name'], example)) | 315 self.AddText(win, '%s\\%s = %s' % (key_name, policy['name'], example)) |
| 315 | 316 |
| 316 def _AddDictionaryExampleLinux(self, parent, policy): | 317 def _AddDictionaryExampleAndroidLinux(self, parent, policy): |
| 317 '''Adds an example value for Linux of a 'dict' policy to a DOM node. | 318 '''Adds an example value for Android/Linux of a 'dict' policy to a DOM node. |
| 318 | 319 |
| 319 Args: | 320 Args: |
| 320 parent: The DOM node for which the example will be added. | 321 parent: The DOM node for which the example will be added. |
| 321 policy: A policy of type 'dict', for which the Linux example value | 322 policy: A policy of type 'dict', for which the Android/Linux example value |
| 322 is generated. | 323 is generated. |
| 323 ''' | 324 ''' |
| 324 self.AddElement(parent, 'dt', {}, 'Linux:') | 325 self.AddElement(parent, 'dt', {}, 'Android/Linux:') |
| 325 linux = self._AddStyledElement(parent, 'dd', ['.monospace']) | 326 element = self._AddStyledElement(parent, 'dd', ['.monospace']) |
| 326 example = json.dumps(policy['example_value']) | 327 example = json.dumps(policy['example_value']) |
| 327 self.AddText(linux, '%s: %s' % (policy['name'], example)) | 328 self.AddText(element, '%s: %s' % (policy['name'], example)) |
| 328 | 329 |
| 329 def _AddDictionaryExample(self, parent, policy): | 330 def _AddDictionaryExample(self, parent, policy): |
| 330 '''Adds the example value of a 'dict' policy to a DOM node. Example output: | 331 '''Adds the example value of a 'dict' policy to a DOM node. Example output: |
| 331 <dl> | 332 <dl> |
| 332 <dt>Windows:</dt> | 333 <dt>Windows:</dt> |
| 333 <dd> | 334 <dd> |
| 334 Software\Policies\Chromium\ProxySettings = "{ 'ProxyMode': 'direct' }" | 335 Software\Policies\Chromium\ProxySettings = "{ 'ProxyMode': 'direct' }" |
| 335 </dd> | 336 </dd> |
| 336 <dt>Linux:</dt> | 337 <dt>Android/Linux:</dt> |
| 337 <dd>"ProxySettings": { | 338 <dd>"ProxySettings": { |
| 338 "ProxyMode": "direct" | 339 "ProxyMode": "direct" |
| 339 } | 340 } |
| 340 </dd> | 341 </dd> |
| 341 <dt>Mac:</dt> | 342 <dt>Mac:</dt> |
| 342 <dd> | 343 <dd> |
| 343 <key>ProxySettings</key> | 344 <key>ProxySettings</key> |
| 344 <dict> | 345 <dict> |
| 345 <key>ProxyMode</key> | 346 <key>ProxyMode</key> |
| 346 <string>direct</string> | 347 <string>direct</string> |
| 347 </dict> | 348 </dict> |
| 348 </dd> | 349 </dd> |
| 349 </dl> | 350 </dl> |
| 350 | 351 |
| 351 Args: | 352 Args: |
| 352 parent: The DOM node for which the example will be added. | 353 parent: The DOM node for which the example will be added. |
| 353 policy: The data structure of a policy. | 354 policy: The data structure of a policy. |
| 354 ''' | 355 ''' |
| 355 examples = self._AddStyledElement(parent, 'dl', ['dd dl']) | 356 examples = self._AddStyledElement(parent, 'dl', ['dd dl']) |
| 356 if self.IsPolicySupportedOnPlatform(policy, 'win'): | 357 if self.IsPolicySupportedOnPlatform(policy, 'win'): |
| 357 self._AddDictionaryExampleWindows(examples, policy) | 358 self._AddDictionaryExampleWindows(examples, policy) |
| 358 if self.IsPolicySupportedOnPlatform(policy, 'linux'): | 359 if (self.IsPolicySupportedOnPlatform(policy, 'android') or |
| 359 self._AddDictionaryExampleLinux(examples, policy) | 360 self.IsPolicySupportedOnPlatform(policy, 'linux')): |
| 361 self._AddDictionaryExampleAndroidLinux(examples, policy) |
| 360 if self.IsPolicySupportedOnPlatform(policy, 'mac'): | 362 if self.IsPolicySupportedOnPlatform(policy, 'mac'): |
| 361 self._AddDictionaryExampleMac(examples, policy) | 363 self._AddDictionaryExampleMac(examples, policy) |
| 362 | 364 |
| 363 def _AddExample(self, parent, policy): | 365 def _AddExample(self, parent, policy): |
| 364 '''Adds the HTML DOM representation of the example value of a policy to | 366 '''Adds the HTML DOM representation of the example value of a policy to |
| 365 a DOM node. It is simple text for boolean policies, like | 367 a DOM node. It is simple text for boolean policies, like |
| 366 '0x00000001 (Windows), true (Linux), <true /> (Mac)' in case of boolean | 368 '0x00000001 (Windows), true (Linux), true (Android), <true /> (Mac)' |
| 367 policies, but it may also contain other HTML elements. (See method | 369 in case of boolean policies, but it may also contain other HTML elements. |
| 368 _AddListExample.) | 370 (See method _AddListExample.) |
| 369 | 371 |
| 370 Args: | 372 Args: |
| 371 parent: The DOM node for which the example will be added. | 373 parent: The DOM node for which the example will be added. |
| 372 policy: The data structure of a policy. | 374 policy: The data structure of a policy. |
| 373 | 375 |
| 374 Raises: | 376 Raises: |
| 375 Exception: If the type of the policy is unknown or the example value | 377 Exception: If the type of the policy is unknown or the example value |
| 376 of the policy is out of its expected range. | 378 of the policy is out of its expected range. |
| 377 ''' | 379 ''' |
| 378 example_value = policy['example_value'] | 380 example_value = policy['example_value'] |
| 379 policy_type = policy['type'] | 381 policy_type = policy['type'] |
| 380 if policy_type == 'main': | 382 if policy_type == 'main': |
| 381 pieces = [] | 383 pieces = [] |
| 382 if self.IsPolicySupportedOnPlatform(policy, 'win'): | 384 if self.IsPolicySupportedOnPlatform(policy, 'win'): |
| 383 value = '0x00000001' if example_value else '0x00000000' | 385 value = '0x00000001' if example_value else '0x00000000' |
| 384 pieces.append(value + ' (Windows)') | 386 pieces.append(value + ' (Windows)') |
| 385 if self.IsPolicySupportedOnPlatform(policy, 'linux'): | 387 if self.IsPolicySupportedOnPlatform(policy, 'linux'): |
| 386 value = 'true' if example_value else 'false' | 388 value = 'true' if example_value else 'false' |
| 387 pieces.append(value + ' (Linux)') | 389 pieces.append(value + ' (Linux)') |
| 390 if self.IsPolicySupportedOnPlatform(policy, 'android'): |
| 391 value = 'true' if example_value else 'false' |
| 392 pieces.append(value + ' (Android)') |
| 388 if self.IsPolicySupportedOnPlatform(policy, 'mac'): | 393 if self.IsPolicySupportedOnPlatform(policy, 'mac'): |
| 389 value = '<true />' if example_value else '<false />' | 394 value = '<true />' if example_value else '<false />' |
| 390 pieces.append(value + ' (Mac)') | 395 pieces.append(value + ' (Mac)') |
| 391 self.AddText(parent, ', '.join(pieces)) | 396 self.AddText(parent, ', '.join(pieces)) |
| 392 elif policy_type == 'string': | 397 elif policy_type == 'string': |
| 393 self.AddText(parent, '"%s"' % example_value) | 398 self.AddText(parent, '"%s"' % example_value) |
| 394 elif policy_type in ('int', 'int-enum'): | 399 elif policy_type in ('int', 'int-enum'): |
| 395 pieces = [] | 400 pieces = [] |
| 396 if self.IsPolicySupportedOnPlatform(policy, 'win'): | 401 if self.IsPolicySupportedOnPlatform(policy, 'win'): |
| 397 pieces.append('0x%08x (Windows)' % example_value) | 402 pieces.append('0x%08x (Windows)' % example_value) |
| 398 if self.IsPolicySupportedOnPlatform(policy, 'linux'): | 403 if self.IsPolicySupportedOnPlatform(policy, 'linux'): |
| 399 pieces.append('%d (Linux)' % example_value) | 404 pieces.append('%d (Linux)' % example_value) |
| 405 if self.IsPolicySupportedOnPlatform(policy, 'android'): |
| 406 pieces.append('%d (Android)' % example_value) |
| 400 if self.IsPolicySupportedOnPlatform(policy, 'mac'): | 407 if self.IsPolicySupportedOnPlatform(policy, 'mac'): |
| 401 pieces.append('%d (Mac)' % example_value) | 408 pieces.append('%d (Mac)' % example_value) |
| 402 self.AddText(parent, ', '.join(pieces)) | 409 self.AddText(parent, ', '.join(pieces)) |
| 403 elif policy_type == 'string-enum': | 410 elif policy_type == 'string-enum': |
| 404 self.AddText(parent, '"%s"' % (example_value)) | 411 self.AddText(parent, '"%s"' % (example_value)) |
| 405 elif policy_type in ('list', 'string-enum-list'): | 412 elif policy_type in ('list', 'string-enum-list'): |
| 406 self._AddListExample(parent, policy) | 413 self._AddListExample(parent, policy) |
| 407 elif policy_type == 'dict': | 414 elif policy_type == 'dict': |
| 408 self._AddDictionaryExample(parent, policy) | 415 self._AddDictionaryExample(parent, policy) |
| 409 else: | 416 else: |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 <dt>Attribute:</dt><dd>Description</dd> | 473 <dt>Attribute:</dt><dd>Description</dd> |
| 467 ... | 474 ... |
| 468 </dl> | 475 </dl> |
| 469 | 476 |
| 470 Args: | 477 Args: |
| 471 parent: A DOM element for which the list will be added. | 478 parent: A DOM element for which the list will be added. |
| 472 policy: The data structure of the policy. | 479 policy: The data structure of the policy. |
| 473 ''' | 480 ''' |
| 474 | 481 |
| 475 dl = self.AddElement(parent, 'dl') | 482 dl = self.AddElement(parent, 'dl') |
| 476 data_type = self._TYPE_MAP[policy['type']] | 483 data_type = [self._TYPE_MAP[policy['type']]] |
| 484 qualified_types = [] |
| 485 is_complex_policy = False |
| 486 if (self.IsPolicySupportedOnPlatform(policy, 'android') and |
| 487 self._RESTRICTION_TYPE_MAP.get(policy['type'], None)): |
| 488 qualified_types.append('Android:%s' % |
| 489 self._RESTRICTION_TYPE_MAP[policy['type']]) |
| 490 if policy['type'] in ('dict', 'list'): |
| 491 is_complex_policy = True |
| 477 if (self.IsPolicySupportedOnPlatform(policy, 'win') and | 492 if (self.IsPolicySupportedOnPlatform(policy, 'win') and |
| 478 self._REG_TYPE_MAP.get(policy['type'], None)): | 493 self._REG_TYPE_MAP.get(policy['type'], None)): |
| 479 data_type += ' (%s)' % self._REG_TYPE_MAP[policy['type']] | 494 qualified_types.append('Windows:%s' % self._REG_TYPE_MAP[policy['type']]) |
| 480 self._AddPolicyAttribute(dl, 'data_type', data_type) | 495 if policy['type'] == 'dict': |
| 496 is_complex_policy = True |
| 497 if qualified_types: |
| 498 data_type.append('[%s]' % ', '.join(qualified_types)) |
| 499 if is_complex_policy: |
| 500 data_type.append('(%s)' % |
| 501 self._GetLocalizedMessage('complex_policies_on_windows')) |
| 502 self._AddPolicyAttribute(dl, 'data_type', ' '.join(data_type)) |
| 481 if policy['type'] != 'external': | 503 if policy['type'] != 'external': |
| 482 # All types except 'external' can be set through platform policy. | 504 # All types except 'external' can be set through platform policy. |
| 483 if self.IsPolicySupportedOnPlatform(policy, 'win'): | 505 if self.IsPolicySupportedOnPlatform(policy, 'win'): |
| 484 if self.CanBeRecommended(policy) and not self.CanBeMandatory(policy): | 506 if self.CanBeRecommended(policy) and not self.CanBeMandatory(policy): |
| 485 key_name = self.config['win_reg_recommended_key_name'] | 507 key_name = self.config['win_reg_recommended_key_name'] |
| 486 else: | 508 else: |
| 487 key_name = self.config['win_reg_mandatory_key_name'] | 509 key_name = self.config['win_reg_mandatory_key_name'] |
| 488 self._AddPolicyAttribute( | 510 self._AddPolicyAttribute( |
| 489 dl, | 511 dl, |
| 490 'win_reg_loc', | 512 'win_reg_loc', |
| 491 key_name + '\\' + policy['name'], | 513 key_name + '\\' + policy['name'], |
| 492 ['.monospace']) | 514 ['.monospace']) |
| 493 if (self.IsPolicySupportedOnPlatform(policy, 'linux') or | 515 if (self.IsPolicySupportedOnPlatform(policy, 'linux') or |
| 494 self.IsPolicySupportedOnPlatform(policy, 'mac')): | 516 self.IsPolicySupportedOnPlatform(policy, 'mac')): |
| 495 self._AddPolicyAttribute( | 517 self._AddPolicyAttribute( |
| 496 dl, | 518 dl, |
| 497 'mac_linux_pref_name', | 519 'mac_linux_pref_name', |
| 498 policy['name'], | 520 policy['name'], |
| 499 ['.monospace']) | 521 ['.monospace']) |
| 522 if self.IsPolicySupportedOnPlatform(policy, 'android'): |
| 523 self._AddPolicyAttribute( |
| 524 dl, |
| 525 'android_restriction_name', |
| 526 policy['name'], |
| 527 ['.monospace']) |
| 500 dd = self._AddPolicyAttribute(dl, 'supported_on') | 528 dd = self._AddPolicyAttribute(dl, 'supported_on') |
| 501 self._AddSupportedOnList(dd, policy['supported_on']) | 529 self._AddSupportedOnList(dd, policy['supported_on']) |
| 502 dd = self._AddPolicyAttribute(dl, 'supported_features') | 530 dd = self._AddPolicyAttribute(dl, 'supported_features') |
| 503 self._AddFeatures(dd, policy) | 531 self._AddFeatures(dd, policy) |
| 504 dd = self._AddPolicyAttribute(dl, 'description') | 532 dd = self._AddPolicyAttribute(dl, 'description') |
| 505 self._AddDescription(dd, policy) | 533 self._AddDescription(dd, policy) |
| 506 if (self.IsPolicySupportedOnPlatform(policy, 'win') or | 534 if (self.IsPolicySupportedOnPlatform(policy, 'win') or |
| 507 self.IsPolicySupportedOnPlatform(policy, 'linux') or | 535 self.IsPolicySupportedOnPlatform(policy, 'linux') or |
| 536 self.IsPolicySupportedOnPlatform(policy, 'android') or |
| 508 self.IsPolicySupportedOnPlatform(policy, 'mac')): | 537 self.IsPolicySupportedOnPlatform(policy, 'mac')): |
| 509 # Don't add an example for ChromeOS-only policies. | 538 # Don't add an example for ChromeOS-only policies. |
| 510 if policy['type'] != 'external': | 539 if policy['type'] != 'external': |
| 511 # All types except 'external' can be set through platform policy. | 540 # All types except 'external' can be set through platform policy. |
| 512 dd = self._AddPolicyAttribute(dl, 'example_value') | 541 dd = self._AddPolicyAttribute(dl, 'example_value') |
| 513 self._AddExample(dd, policy) | 542 self._AddExample(dd, policy) |
| 514 | 543 |
| 515 def _AddPolicyNote(self, parent, policy): | 544 def _AddPolicyNote(self, parent, policy): |
| 516 '''If a policy has an additional web page assigned with it, then add | 545 '''If a policy has an additional web page assigned with it, then add |
| 517 a link for that page. | 546 a link for that page. |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 'string': 'String', | 697 'string': 'String', |
| 669 'int': 'Integer', | 698 'int': 'Integer', |
| 670 'main': 'Boolean', | 699 'main': 'Boolean', |
| 671 'int-enum': 'Integer', | 700 'int-enum': 'Integer', |
| 672 'string-enum': 'String', | 701 'string-enum': 'String', |
| 673 'list': 'List of strings', | 702 'list': 'List of strings', |
| 674 'string-enum-list': 'List of strings', | 703 'string-enum-list': 'List of strings', |
| 675 'dict': 'Dictionary', | 704 'dict': 'Dictionary', |
| 676 'external': 'External data reference', | 705 'external': 'External data reference', |
| 677 } | 706 } |
| 678 reg_dict = 'REG_SZ; %s' % self._GetLocalizedMessage( | |
| 679 'complex_policies_on_windows') | |
| 680 self._REG_TYPE_MAP = { | 707 self._REG_TYPE_MAP = { |
| 681 'string': 'REG_SZ', | 708 'string': 'REG_SZ', |
| 682 'int': 'REG_DWORD', | 709 'int': 'REG_DWORD', |
| 683 'main': 'REG_DWORD', | 710 'main': 'REG_DWORD', |
| 684 'int-enum': 'REG_DWORD', | 711 'int-enum': 'REG_DWORD', |
| 685 'string-enum': 'REG_SZ', | 712 'string-enum': 'REG_SZ', |
| 686 'dict': reg_dict, | 713 'dict': 'REG_SZ', |
| 714 } |
| 715 self._RESTRICTION_TYPE_MAP = { |
| 716 'int-enum': 'choice', |
| 717 'string-enum': 'choice', |
| 718 'list': 'string', |
| 719 'string-enum-list': 'multi-select', |
| 720 'dict': 'string', |
| 687 } | 721 } |
| 688 # The CSS style-sheet used for the document. It will be used in Google | 722 # The CSS style-sheet used for the document. It will be used in Google |
| 689 # Sites, which strips class attributes from HTML tags. To work around this, | 723 # Sites, which strips class attributes from HTML tags. To work around this, |
| 690 # the style-sheet is a dictionary and the style attributes will be added | 724 # the style-sheet is a dictionary and the style attributes will be added |
| 691 # "by hand" for each element. | 725 # "by hand" for each element. |
| 692 self._STYLE = { | 726 self._STYLE = { |
| 693 'table': 'border-style: none; border-collapse: collapse;', | 727 'table': 'border-style: none; border-collapse: collapse;', |
| 694 'tr': 'height: 0px;', | 728 'tr': 'height: 0px;', |
| 695 'td': 'border: 1px dotted rgb(170, 170, 170); padding: 7px; ' | 729 'td': 'border: 1px dotted rgb(170, 170, 170); padding: 7px; ' |
| 696 'vertical-align: top; width: 236px; height: 15px;', | 730 'vertical-align: top; width: 236px; height: 15px;', |
| 697 'thead td': 'font-weight: bold;', | 731 'thead td': 'font-weight: bold;', |
| 698 'td.left': 'width: 200px;', | 732 'td.left': 'width: 200px;', |
| 699 'td.right': 'width: 100%;', | 733 'td.right': 'width: 100%;', |
| 700 'dt': 'font-weight: bold;', | 734 'dt': 'font-weight: bold;', |
| 701 'dd dl': 'margin-top: 0px; margin-bottom: 0px;', | 735 'dd dl': 'margin-top: 0px; margin-bottom: 0px;', |
| 702 '.monospace': 'font-family: monospace;', | 736 '.monospace': 'font-family: monospace;', |
| 703 '.pre': 'white-space: pre;', | 737 '.pre': 'white-space: pre;', |
| 704 'div.note': 'border: 2px solid black; padding: 5px; margin: 5px;', | 738 'div.note': 'border: 2px solid black; padding: 5px; margin: 5px;', |
| 705 'div.group_desc': 'margin-top: 20px; margin-bottom: 20px;', | 739 'div.group_desc': 'margin-top: 20px; margin-bottom: 20px;', |
| 706 'ul': 'padding-left: 0px; margin-left: 0px;' | 740 'ul': 'padding-left: 0px; margin-left: 0px;' |
| 707 } | 741 } |
| 708 | 742 |
| 709 | 743 |
| 710 def GetTemplateText(self): | 744 def GetTemplateText(self): |
| 711 # Return the text representation of the main <div> tag. | 745 # Return the text representation of the main <div> tag. |
| 712 return self._main_div.toxml() | 746 return self._main_div.toxml() |
| 713 # To get a complete HTML file, use the following. | 747 # To get a complete HTML file, use the following. |
| 714 # return self._doc.toxml() | 748 # return self._doc.toxml() |
| OLD | NEW |