Index: net/tools/testserver/device_management.py |
diff --git a/net/tools/testserver/device_management.py b/net/tools/testserver/device_management.py |
index 70376087e31c3bfcab7e908dd77639db95174526..3647c579826b3144d3f444926b4d5000bda6612a 100644 |
--- a/net/tools/testserver/device_management.py |
+++ b/net/tools/testserver/device_management.py |
@@ -226,17 +226,17 @@ class RequestHandler(object): |
will contain the error response to send back. |
""" |
error = None |
- |
+ dmtoken = None |
match = re.match('GoogleDMToken token=(\\w+)', |
self._headers.getheader('Authorization', '')) |
if match: |
dmtoken = match.group(1) |
- if not dmtoken: |
- error = dm.DeviceManagementResponse.DEVICE_MANAGEMENT_TOKEN_INVALID |
- elif not self._server.LookupDevice(dmtoken): |
- error = dm.DeviceManagementResponse.DEVICE_NOT_FOUND |
- else: |
- return (dmtoken, None) |
+ if not dmtoken: |
+ error = dm.DeviceManagementResponse.DEVICE_MANAGEMENT_TOKEN_INVALID |
+ elif not self._server.LookupDevice(dmtoken): |
+ error = dm.DeviceManagementResponse.DEVICE_NOT_FOUND |
+ else: |
+ return (dmtoken, None) |
response = dm.DeviceManagementResponse() |
response.error = error |