Chromium Code Reviews| Index: chrome/browser/policy/test/policy_testserver.py |
| diff --git a/chrome/browser/policy/test/policy_testserver.py b/chrome/browser/policy/test/policy_testserver.py |
| index 185296c137febd111c283f96cdcedbff81f97045..ef2b0ba8e8d57d7ad99948d035b8abc128ac634d 100644 |
| --- a/chrome/browser/policy/test/policy_testserver.py |
| +++ b/chrome/browser/policy/test/policy_testserver.py |
| @@ -71,16 +71,7 @@ import tlslite.api |
| import tlslite.utils |
| import tlslite.utils.cryptomath |
| import urlparse |
| - |
| -# The name and availability of the json module varies in python versions. |
| -try: |
| - import simplejson as json |
| -except ImportError: |
| - try: |
| - import json |
| - except ImportError: |
| - json = None |
| - |
| +import json |
|
Mattias Nissler (ping if slow)
2015/06/15 07:47:18
alphabetize
|
| import asn1der |
| import testserver_base |
| @@ -759,6 +750,10 @@ class PolicyRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): |
| if payload is None: |
| payload = self.CreatePolicyForExternalPolicyData(policy_key) |
| else: |
| + if ep is None: |
| + logging.error('chrome_extension_policy_pb2 does not exist') |
| + if dp is None: |
| + logging.error('chrome_device_policy_pb2 does not exist') |
|
Mattias Nissler (ping if slow)
2015/06/15 07:47:18
Why not just drop the ep is None and dp is None ch
|
| response.error_code = 400 |
| response.error_message = 'Invalid policy type' |
| return |
| @@ -986,12 +981,12 @@ class PolicyTestServer(testserver_base.BrokenPipeHandlerMixIn, |
| """ |
| policy = {} |
| if json is None: |
| - print 'No JSON module, cannot parse policy information' |
| + logging.error('No JSON module, cannot parse policy information') |
| else : |
| try: |
| policy = json.loads(open(self.policy_path).read(), strict=False) |
| except IOError: |
| - print 'Failed to load policy from %s' % self.policy_path |
| + logging.error('Failed to load policies from %s' % self.policy_path) |
| return policy |
| def RegisterDevice(self, device_id, machine_id, type): |