Chromium Code Reviews| Index: chrome/app/policy/syntax_check_policy_template_json.py |
| diff --git a/chrome/app/policy/syntax_check_policy_template_json.py b/chrome/app/policy/syntax_check_policy_template_json.py |
| index 06f600cb767b55112aff6f0bb0e0a346369917de..3a1352896edd6e2e65e00a41a05362cfde201321 100755 |
| --- a/chrome/app/policy/syntax_check_policy_template_json.py |
| +++ b/chrome/app/policy/syntax_check_policy_template_json.py |
| @@ -28,6 +28,7 @@ TYPE_TO_SCHEMA = { |
| 'string': 'string', |
| 'int-enum': 'integer', |
| 'string-enum': 'string', |
| + 'external': 'object', |
| } |
| # List of boolean policies that have been introduced with negative polarity in |
| @@ -173,7 +174,7 @@ class PolicyTemplateChecker(object): |
| if key not in ('name', 'type', 'caption', 'desc', 'device_only', |
| 'supported_on', 'label', 'policies', 'items', |
| 'example_value', 'features', 'deprecated', 'future', |
| - 'id', 'schema'): |
| + 'id', 'schema', 'max_size'): |
| self.warning_count += 1 |
| print ('In policy %s: Warning: Unknown key: %s' % |
| (policy.get('name'), key)) |
| @@ -182,12 +183,12 @@ class PolicyTemplateChecker(object): |
| self._CheckContains(policy, 'name', str, regexp_check=NO_WHITESPACE) |
| # Each policy must have a type. |
| + policy_types = ('group', 'main', 'string', 'int', 'list', 'int-enum', |
| + 'string-enum', 'dict', 'external') |
| policy_type = self._CheckContains(policy, 'type', str) |
| - if policy_type not in ('group', 'main', 'string', 'int', 'list', 'int-enum', |
| - 'string-enum', 'dict'): |
| - self._Error('Policy type must be either of: group, main, string, int, ' |
| - 'list, int-enum, string-enum, dict', |
| - 'policy', policy, policy_type) |
| + if policy_type not in policy_types: |
| + self._Error('Policy type must be one of: ' + ', '.join(policy_types), |
| + 'policy', policy.get('name'), policy_type) |
| return # Can't continue for unsupported type. |
| # Each policy must have a caption message. |
| @@ -278,7 +279,7 @@ class PolicyTemplateChecker(object): |
| value_type = int |
| elif policy_type == 'list': |
| value_type = list |
| - elif policy_type == 'dict': |
| + elif policy_type in ('dict', 'external'): |
| value_type = dict |
| else: |
| raise NotImplementedError('Unimplemented policy type: %s' % policy_type) |
| @@ -313,6 +314,11 @@ class PolicyTemplateChecker(object): |
| self._CheckContains(item, 'caption', str, container_name='item', |
| identifier=policy.get('name')) |
| + if policy_type == 'external': |
| + |
|
Joao da Silva
2013/07/19 11:15:15
This newline is strange, do you mind fixing it her
bartfab (slow)
2013/07/19 13:06:30
Done.
|
| + # Each policy referencing external data must specify a maximum data size. |
| + self._CheckContains(policy, 'max_size', int) |
| + |
| def _CheckMessage(self, key, value): |
| # |key| must be a string, |value| a dict. |
| if not isinstance(key, str): |