diff options
Diffstat (limited to 'boto')
-rw-r--r-- | boto/cloudfront/identity.py | 6 | ||||
-rw-r--r-- | boto/cloudfront/signers.py | 2 | ||||
-rw-r--r-- | boto/ec2/group.py | 2 | ||||
-rw-r--r-- | boto/ec2/instance.py | 2 | ||||
-rw-r--r-- | boto/ec2/volume.py | 1 | ||||
-rw-r--r-- | boto/exception.py | 20 | ||||
-rw-r--r-- | boto/mturk/layoutparam.py | 2 | ||||
-rw-r--r-- | boto/mturk/qualification.py | 6 | ||||
-rw-r--r-- | boto/pyami/scriptbase.py | 2 | ||||
-rw-r--r-- | boto/s3/acl.py | 4 | ||||
-rw-r--r-- | boto/s3/bucketlistresultset.py | 2 | ||||
-rw-r--r-- | boto/s3/bucketlogging.py | 4 | ||||
-rw-r--r-- | boto/s3/deletemarker.py | 2 | ||||
-rw-r--r-- | boto/s3/user.py | 4 | ||||
-rw-r--r-- | boto/sdb/db/manager/xmlmanager.py | 16 | ||||
-rw-r--r-- | boto/sdb/domain.py | 32 | ||||
-rw-r--r-- | boto/sdb/queryresultset.py | 4 | ||||
-rw-r--r-- | boto/services/result.py | 4 | ||||
-rw-r--r-- | boto/services/submit.py | 2 | ||||
-rw-r--r-- | boto/sqs/message.py | 16 |
20 files changed, 72 insertions, 61 deletions
diff --git a/boto/cloudfront/identity.py b/boto/cloudfront/identity.py index 372912a8..123773d1 100644 --- a/boto/cloudfront/identity.py +++ b/boto/cloudfront/identity.py @@ -30,7 +30,7 @@ class OriginAccessIdentity(object): self.s3_user_id = s3_user_id self.comment = comment self.etag = None - + def startElement(self, name, attrs, connection): if name == 'CloudFrontOriginAccessIdentityConfig': self.config = OriginAccessIdentityConfig() @@ -102,7 +102,7 @@ class OriginAccessIdentitySummary(object): self.s3_user_id = s3_user_id self.comment = comment self.etag = None - + def startElement(self, name, attrs, connection): return None @@ -118,4 +118,4 @@ class OriginAccessIdentitySummary(object): def get_origin_access_identity(self): return self.connection.get_origin_access_identity_info(self.id) - + diff --git a/boto/cloudfront/signers.py b/boto/cloudfront/signers.py index 3509f56a..dcc9fc9e 100644 --- a/boto/cloudfront/signers.py +++ b/boto/cloudfront/signers.py @@ -23,7 +23,7 @@ class Signer(object): def __init__(self): self.id = None self.key_pair_ids = [] - + def startElement(self, name, attrs, connection): return None diff --git a/boto/ec2/group.py b/boto/ec2/group.py index effb6586..fef54977 100644 --- a/boto/ec2/group.py +++ b/boto/ec2/group.py @@ -35,4 +35,4 @@ class Group(object): self.name = value else: setattr(self, name, value) - + diff --git a/boto/ec2/instance.py b/boto/ec2/instance.py index 4e834b2b..241fa234 100644 --- a/boto/ec2/instance.py +++ b/boto/ec2/instance.py @@ -628,7 +628,6 @@ class ConsoleOutput(object): class InstanceAttribute(dict): - ValidValues = ['instanceType', 'kernel', 'ramdisk', 'userData', 'disableApiTermination', 'instanceInitiatedShutdownBehavior', @@ -667,7 +666,6 @@ class InstanceAttribute(dict): class SubParse(dict): - def __init__(self, section, parent=None): dict.__init__(self) self.section = section diff --git a/boto/ec2/volume.py b/boto/ec2/volume.py index 7099871a..a084f647 100644 --- a/boto/ec2/volume.py +++ b/boto/ec2/volume.py @@ -260,7 +260,6 @@ class AttachmentSet(object): :ivar attach_time: Attached since :ivar device: The device the instance has mapped """ - def __init__(self): self.id = None self.instance_id = None diff --git a/boto/exception.py b/boto/exception.py index 51fea1be..f0e1daaf 100644 --- a/boto/exception.py +++ b/boto/exception.py @@ -34,7 +34,6 @@ class BotoClientError(StandardError): """ General Boto Client error (error accessing AWS) """ - def __init__(self, reason, *args): StandardError.__init__(self, reason, *args) self.reason = reason @@ -49,18 +48,21 @@ class BotoClientError(StandardError): class SDBPersistenceError(StandardError): pass + class StoragePermissionsError(BotoClientError): """ Permissions error when accessing a bucket or key on a storage service. """ pass + class S3PermissionsError(StoragePermissionsError): """ Permissions error when accessing a bucket or key on S3. """ pass + class GSPermissionsError(StoragePermissionsError): """ Permissions error when accessing a bucket or key on GS. @@ -154,6 +156,7 @@ class ConsoleOutput(object): else: setattr(self, name, value) + class StorageCreateError(BotoServerError): """ Error creating a bucket or key on a storage service. @@ -174,30 +177,35 @@ class S3CreateError(StorageCreateError): """ pass + class GSCreateError(StorageCreateError): """ Error creating a bucket or key on GS. """ pass + class StorageCopyError(BotoServerError): """ Error copying a key on a storage service. """ pass + class S3CopyError(StorageCopyError): """ Error copying a key on S3. """ pass + class GSCopyError(StorageCopyError): """ Error copying a key on GS. """ pass + class SQSError(BotoServerError): """ General Error on Simple Queue Service. @@ -223,6 +231,7 @@ class SQSError(BotoServerError): for p in ('detail', 'type'): setattr(self, p, None) + class SQSDecodeError(BotoClientError): """ Error when decoding an SQS message. @@ -237,6 +246,7 @@ class SQSDecodeError(BotoClientError): def __str__(self): return 'SQSDecodeError: %s' % self.reason + class StorageResponseError(BotoServerError): """ Error in response from a storage service. @@ -259,23 +269,25 @@ class StorageResponseError(BotoServerError): for p in ('resource'): setattr(self, p, None) + class S3ResponseError(StorageResponseError): """ Error in response from S3. """ pass + class GSResponseError(StorageResponseError): """ Error in response from GS. """ pass + class EC2ResponseError(BotoServerError): """ Error in response from EC2. """ - def __init__(self, status, reason, body=None): self.errors = None self._errorResultSet = [] @@ -304,6 +316,7 @@ class EC2ResponseError(BotoServerError): for p in ('errors'): setattr(self, p, None) + class JSONResponseError(BotoServerError): """ This exception expects the fully parsed and decoded JSON response @@ -342,8 +355,8 @@ class EmrResponseError(BotoServerError): """ pass -class _EC2Error: +class _EC2Error(object): def __init__(self, connection=None): self.connection = connection self.error_code = None @@ -360,6 +373,7 @@ class _EC2Error: else: return None + class SDBResponseError(BotoServerError): """ Error in responses from SDB. diff --git a/boto/mturk/layoutparam.py b/boto/mturk/layoutparam.py index 045beea7..781f981d 100644 --- a/boto/mturk/layoutparam.py +++ b/boto/mturk/layoutparam.py @@ -46,7 +46,7 @@ class LayoutParameter(object): def __init__(self, name, value): self.name = name self.value = value - + def get_as_params(self): params = { "Name": self.name, diff --git a/boto/mturk/qualification.py b/boto/mturk/qualification.py index 7724e6d8..c59cabd2 100644 --- a/boto/mturk/qualification.py +++ b/boto/mturk/qualification.py @@ -49,7 +49,7 @@ class Requirement(object): self.comparator = comparator self.integer_value = integer_value self.required_to_preview = required_to_preview - + def get_as_params(self): params = { "QualificationTypeId": self.qualification_type_id, @@ -105,7 +105,7 @@ class NumberHitsApprovedRequirement(Requirement): """ Specifies the total number of HITs submitted by a Worker that have been approved. The value is an integer greater than or equal to 0. """ - + def __init__(self, comparator, integer_value, required_to_preview=False): Requirement.__init__(self, qualification_type_id="00000000000000000040", comparator=comparator, integer_value=integer_value, required_to_preview=required_to_preview) @@ -132,6 +132,6 @@ class AdultRequirement(Requirement): """ Requires workers to acknowledge that they are over 18 and that they agree to work on potentially offensive content. The value type is boolean, 1 (required), 0 (not required, the default). """ - + def __init__(self, comparator, integer_value, required_to_preview=False): Requirement.__init__(self, qualification_type_id="00000000000000000060", comparator=comparator, integer_value=integer_value, required_to_preview=required_to_preview) diff --git a/boto/pyami/scriptbase.py b/boto/pyami/scriptbase.py index fd5d563d..8e8cb0c0 100644 --- a/boto/pyami/scriptbase.py +++ b/boto/pyami/scriptbase.py @@ -41,4 +41,4 @@ class ScriptBase(object): def main(self): pass - + diff --git a/boto/s3/acl.py b/boto/s3/acl.py index ca327898..c54ddc62 100644 --- a/boto/s3/acl.py +++ b/boto/s3/acl.py @@ -160,5 +160,5 @@ class Grant(object): s += '<Permission>%s</Permission>' % self.permission s += '</Grant>' return s - - + + diff --git a/boto/s3/bucketlistresultset.py b/boto/s3/bucketlistresultset.py index b883f1e8..5782cbf3 100644 --- a/boto/s3/bucketlistresultset.py +++ b/boto/s3/bucketlistresultset.py @@ -14,7 +14,7 @@ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. diff --git a/boto/s3/bucketlogging.py b/boto/s3/bucketlogging.py index 2d413440..ab368392 100644 --- a/boto/s3/bucketlogging.py +++ b/boto/s3/bucketlogging.py @@ -14,7 +14,7 @@ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. @@ -68,7 +68,7 @@ class BucketLogging(object): # caller is responsible to encode to utf-8 s = u'<?xml version="1.0" encoding="UTF-8"?>' s += u'<BucketLoggingStatus xmlns="http://doc.s3.amazonaws.com/2006-03-01">' - if self.target is not None: + if self.target is not None: s += u'<LoggingEnabled>' s += u'<TargetBucket>%s</TargetBucket>' % self.target prefix = self.prefix or '' diff --git a/boto/s3/deletemarker.py b/boto/s3/deletemarker.py index 26f42db5..d8e7cc8b 100644 --- a/boto/s3/deletemarker.py +++ b/boto/s3/deletemarker.py @@ -14,7 +14,7 @@ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. diff --git a/boto/s3/user.py b/boto/s3/user.py index 2d69e9c7..f2cbbb7f 100644 --- a/boto/s3/user.py +++ b/boto/s3/user.py @@ -14,7 +14,7 @@ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. @@ -46,4 +46,4 @@ class User(object): s += '<ID>%s</ID>' % self.id s += '<DisplayName>%s</DisplayName>' % self.display_name s += '</%s>' % element_name - return s + return s diff --git a/boto/sdb/db/manager/xmlmanager.py b/boto/sdb/db/manager/xmlmanager.py index 577eac93..c4cc5d3e 100644 --- a/boto/sdb/db/manager/xmlmanager.py +++ b/boto/sdb/db/manager/xmlmanager.py @@ -14,7 +14,7 @@ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. @@ -179,7 +179,7 @@ class XMLConverter(object): class XMLManager(object): - + def __init__(self, cls, db_name, db_user, db_passwd, db_host, db_port, db_table, ddl_dir, enable_ssl): self.cls = cls @@ -260,7 +260,7 @@ class XMLManager(object): def get_doc(self): return self.doc - + def encode_value(self, prop, value): return self.converter.encode_prop(prop, value) @@ -324,8 +324,8 @@ class XMLManager(object): if value != None: props[prop.name] = value return (cls, props, id) - - + + def get_object(self, cls, id): if not self.connection: self._connect() @@ -352,7 +352,7 @@ class XMLManager(object): query = str(self._build_query(cls, filters, limit, order_by)) if query: url = "/%s?%s" % (self.db_name, urlencode({"query": query})) - else: + else: url = "/%s" % self.db_name resp = self._make_request('GET', url) if resp.status == 200: @@ -471,7 +471,7 @@ class XMLManager(object): else: doc = parse(fp) return self.get_object_from_doc(cls, id, doc) - + def unmarshal_props(self, fp, cls=None, id=None): """ Same as unmarshalling an object, except it returns @@ -499,7 +499,7 @@ class XMLManager(object): return a[name] else: return None - + def get_raw_item(self, obj): return self.domain.get_item(obj.id) diff --git a/boto/sdb/domain.py b/boto/sdb/domain.py index 2d995c6c..137709dc 100644 --- a/boto/sdb/domain.py +++ b/boto/sdb/domain.py @@ -14,7 +14,7 @@ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. @@ -64,19 +64,19 @@ class Domain(object): :type expected_value: list :param expected_value: If supplied, this is a list or tuple consisting - of a single attribute name and expected value. The list can be + of a single attribute name and expected value. The list can be of the form: * ['name', 'value'] - In which case the call will first verify that the attribute + In which case the call will first verify that the attribute "name" of this item has a value of "value". If it does, the delete - will proceed, otherwise a ConditionalCheckFailed error will be + will proceed, otherwise a ConditionalCheckFailed error will be returned. The list can also be of the form: - + * ['name', True|False] - - which will simply check for the existence (True) or non-existence + + which will simply check for the existence (True) or non-existence (False) of the attribute. :type replace: bool @@ -144,22 +144,22 @@ class Domain(object): a dict or Item containing the attribute names and keys and list of values to delete as the value. If no value is supplied, all attribute name/values for the item will be deleted. - + :type expected_value: list :param expected_value: If supplied, this is a list or tuple consisting - of a single attribute name and expected value. The list can be of + of a single attribute name and expected value. The list can be of the form: * ['name', 'value'] In which case the call will first verify that the attribute "name" of this item has a value of "value". If it does, the delete - will proceed, otherwise a ConditionalCheckFailed error will be + will proceed, otherwise a ConditionalCheckFailed error will be returned. The list can also be of the form: * ['name', True|False] - which will simply check for the existence (True) or + which will simply check for the existence (True) or non-existence (False) of the attribute. :rtype: bool @@ -171,7 +171,7 @@ class Domain(object): def batch_delete_attributes(self, items): """ Delete multiple items in this domain. - + :type items: dict or dict-like object :param items: A dictionary-like object. The keys of the dictionary are the item names and the values are either: @@ -182,7 +182,7 @@ class Domain(object): will only be deleted if they match the name/value pairs passed in. * None which means that all attributes associated - with the item should be deleted. + with the item should be deleted. :rtype: bool :return: True if successful @@ -209,12 +209,12 @@ class Domain(object): def get_item(self, item_name, consistent_read=False): """ Retrieves an item from the domain, along with all of its attributes. - + :param string item_name: The name of the item to retrieve. :rtype: :class:`boto.sdb.item.Item` or ``None`` - :keyword bool consistent_read: When set to true, ensures that the most + :keyword bool consistent_read: When set to true, ensures that the most recent data is returned. - :return: The requested item, or ``None`` if there was no match found + :return: The requested item, or ``None`` if there was no match found """ item = self.get_attributes(item_name, consistent_read=consistent_read) if item: diff --git a/boto/sdb/queryresultset.py b/boto/sdb/queryresultset.py index 84d2b391..f943949f 100644 --- a/boto/sdb/queryresultset.py +++ b/boto/sdb/queryresultset.py @@ -14,7 +14,7 @@ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. @@ -60,7 +60,7 @@ def select_lister(domain, query='', max_items=None): num_results += 1 next_token = rs.next_token more_results = next_token != None - + class SelectResultSet(object): def __init__(self, domain=None, query='', max_items=None, diff --git a/boto/services/result.py b/boto/services/result.py index cae4b15b..5f6d800d 100644 --- a/boto/services/result.py +++ b/boto/services/result.py @@ -15,7 +15,7 @@ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. @@ -133,4 +133,4 @@ class ResultProcessor(object): print 'Elapsed Time: %d' % self.elapsed_time.seconds tput = 1.0 / ((self.elapsed_time.seconds/60.0) / self.num_files) print 'Throughput: %f transactions / minute' % tput - + diff --git a/boto/services/submit.py b/boto/services/submit.py index 24db901f..2bc72241 100644 --- a/boto/services/submit.py +++ b/boto/services/submit.py @@ -14,7 +14,7 @@ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. diff --git a/boto/sqs/message.py b/boto/sqs/message.py index 34ce7388..0afc15a9 100644 --- a/boto/sqs/message.py +++ b/boto/sqs/message.py @@ -14,7 +14,7 @@ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT -# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. @@ -28,7 +28,7 @@ Message are here: http://docs.amazonwebservices.com/AWSSimpleQueueService/2008-01-01/SQSDeveloperGuide/Query_QuerySendMessage.html So, at it's simplest level a Message just needs to allow a developer to store bytes in it and get the bytes -back out. However, to allow messages to have richer semantics, the Message class must support the +back out. However, to allow messages to have richer semantics, the Message class must support the following interfaces: The constructor for the Message class must accept a keyword parameter "queue" which is an instance of a @@ -76,7 +76,7 @@ class RawMessage(object): will be written to SQS and whatever is returned from SQS is stored directly into the body of the message. """ - + def __init__(self, queue=None, body=''): self.queue = queue self.set_body(body) @@ -115,14 +115,14 @@ class RawMessage(object): def decode(self, value): """Transform seralized byte array into any object.""" return value - + def set_body(self, body): """Override the current body for this object, using decoded format.""" self._body = body def get_body(self): return self._body - + def get_body_encoded(self): """ This method is really a semi-private method used by the Queue.write @@ -140,7 +140,7 @@ class RawMessage(object): self.queue.connection.change_message_visibility(self.queue, self.receipt_handle, visibility_timeout) - + class Message(RawMessage): """ The default Message class used for SQS queues. This class automatically @@ -152,7 +152,7 @@ class Message(RawMessage): for details on why this is a good idea. The encode/decode is meant to be transparent to the end-user. """ - + def encode(self, value): return base64.b64encode(value) @@ -256,4 +256,4 @@ class EncodedMHMessage(MHMessage): def encode(self, value): value = MHMessage.encode(self, value) return base64.b64encode(value) - + |