Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python2.4 | 1 #!/usr/bin/python2.4 |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 """An implementation of the server side of the Chromium sync protocol. | 6 """An implementation of the server side of the Chromium sync protocol. |
| 7 | 7 |
| 8 The details of the protocol are described mostly by comments in the protocol | 8 The details of the protocol are described mostly by comments in the protocol |
| 9 buffer definition at chrome/browser/sync/protocol/sync.proto. | 9 buffer definition at chrome/browser/sync/protocol/sync.proto. |
| 10 """ | 10 """ |
| (...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 948 response = 'Please specify one or more <i>type=name</i> parameters' | 948 response = 'Please specify one or more <i>type=name</i> parameters' |
| 949 code = 400 | 949 code = 400 |
| 950 except DataTypeIdNotRecognized, error: | 950 except DataTypeIdNotRecognized, error: |
| 951 response = 'Could not interpret datatype name' | 951 response = 'Could not interpret datatype name' |
| 952 code = 400 | 952 code = 400 |
| 953 finally: | 953 finally: |
| 954 self.account_lock.release() | 954 self.account_lock.release() |
| 955 return (code, '<html><title>Migration: %d</title><H1>%d %s</H1></html>' % | 955 return (code, '<html><title>Migration: %d</title><H1>%d %s</H1></html>' % |
| 956 (code, code, response)) | 956 (code, code, response)) |
| 957 | 957 |
| 958 def HandleCreateBirthdayError(self): | |
| 959 self.account.store_birthday = '%0.30f' % random.random() | |
|
try_nick_at_chromium_org
2011/07/26 19:50:22
I'd prefer this be a call into a method of SyncDat
lipalani1
2011/07/27 01:15:22
Done.
| |
| 960 return ( | |
| 961 200, | |
| 962 '<html><title>Birthday error</title><H1>Birthday error</H1></html>') | |
| 963 | |
| 958 def HandleCommand(self, query, raw_request): | 964 def HandleCommand(self, query, raw_request): |
| 959 """Decode and handle a sync command from a raw input of bytes. | 965 """Decode and handle a sync command from a raw input of bytes. |
| 960 | 966 |
| 961 This is the main entry point for this class. It is safe to call this | 967 This is the main entry point for this class. It is safe to call this |
| 962 method from multiple threads. | 968 method from multiple threads. |
| 963 | 969 |
| 964 Args: | 970 Args: |
| 965 raw_request: An iterable byte sequence to be interpreted as a sync | 971 raw_request: An iterable byte sequence to be interpreted as a sync |
| 966 protocol command. | 972 protocol command. |
| 967 Returns: | 973 Returns: |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1087 | 1093 |
| 1088 update_sieve.CheckMigrationState() | 1094 update_sieve.CheckMigrationState() |
| 1089 | 1095 |
| 1090 new_timestamp, entries, remaining = self.account.GetChanges(update_sieve) | 1096 new_timestamp, entries, remaining = self.account.GetChanges(update_sieve) |
| 1091 | 1097 |
| 1092 update_response.changes_remaining = remaining | 1098 update_response.changes_remaining = remaining |
| 1093 for entry in entries: | 1099 for entry in entries: |
| 1094 reply = update_response.entries.add() | 1100 reply = update_response.entries.add() |
| 1095 reply.CopyFrom(entry) | 1101 reply.CopyFrom(entry) |
| 1096 update_sieve.SaveProgress(new_timestamp, update_response) | 1102 update_sieve.SaveProgress(new_timestamp, update_response) |
| OLD | NEW |