We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Route53: ResourceRecordSet changes length when iterated through multiple times
When iterating through a ResourceRecordSet the first iteration produced the correct number but subsequent iterations show the size of the ResourceRecordSet as 100

This gist shows a basic example:
https://gist.github.com/jameslegg/6141226


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `boto/route53/record.py`
Content:
```
1 # Copyright (c) 2010 Chris Moyer http://coredumped.org/
2 # Copyright (c) 2012 Mitch Garnaat http://garnaat.org/
3 # Copyright (c) 2012 Amazon.com, Inc. or its affiliates.
4 # All rights reserved.
5 #
6 # Permission is hereby granted, free of charge, to any person obtaining a
7 # copy of this software and associated documentation files (the
8 # "Software"), to deal in the Software without restriction, including
9 # without limitation the rights to use, copy, modify, merge, publish, dis-
10 # tribute, sublicense, and/or sell copies of the Software, and to permit
11 # persons to whom the Software is furnished to do so, subject to the fol-
12 # lowing conditions:
13 #
14 # The above copyright notice and this permission notice shall be included
15 # in all copies or substantial portions of the Software.
16 #
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
19 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
20 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
23 # IN THE SOFTWARE.
24 
25 RECORD_TYPES = ['A', 'AAAA', 'TXT', 'CNAME', 'MX', 'PTR', 'SRV', 'SPF']
26 
27 from boto.resultset import ResultSet
28 class ResourceRecordSets(ResultSet):
29     """
30     A list of resource records.
31 
32     :ivar hosted_zone_id: The ID of the hosted zone.
33     :ivar comment: A comment that will be stored with the change.
34     :ivar changes: A list of changes.
35     """
36 
37     ChangeResourceRecordSetsBody = """<?xml version="1.0" encoding="UTF-8"?>
38     <ChangeResourceRecordSetsRequest xmlns="https://route53.amazonaws.com/doc/2012-02-29/">
39             <ChangeBatch>
40                 <Comment>%(comment)s</Comment>
41                 <Changes>%(changes)s</Changes>
42             </ChangeBatch>
43         </ChangeResourceRecordSetsRequest>"""
44 
45     ChangeXML = """<Change>
46         <Action>%(action)s</Action>
47         %(record)s
48     </Change>"""
49 
50     def __init__(self, connection=None, hosted_zone_id=None, comment=None):
51         self.connection = connection
52         self.hosted_zone_id = hosted_zone_id
53         self.comment = comment
54         self.changes = []
55         self.next_record_name = None
56         self.next_record_type = None
57         ResultSet.__init__(self, [('ResourceRecordSet', Record)])
58 
59     def __repr__(self):
60         if self.changes:
61             record_list = ','.join([c.__repr__() for c in self.changes])
62         else:
63             record_list = ','.join([record.__repr__() for record in self])
64         return '<ResourceRecordSets:%s [%s]' % (self.hosted_zone_id,
65                                                 record_list)
66 
67     def add_change(self, action, name, type, ttl=600,
68             alias_hosted_zone_id=None, alias_dns_name=None, identifier=None,
69             weight=None, region=None):
70         """
71         Add a change request to the set.
72 
73         :type action: str
74         :param action: The action to perform ('CREATE'|'DELETE')
75 
76         :type name: str
77         :param name: The name of the domain you want to perform the action on.
78 
79         :type type: str
80         :param type: The DNS record type.  Valid values are:
81 
82             * A
83             * AAAA
84             * CNAME
85             * MX
86             * NS
87             * PTR
88             * SOA
89             * SPF
90             * SRV
91             * TXT
92 
93         :type ttl: int
94         :param ttl: The resource record cache time to live (TTL), in seconds.
95 
96         :type alias_hosted_zone_id: str
97         :param alias_dns_name: *Alias resource record sets only* The value
98             of the hosted zone ID, CanonicalHostedZoneNameId, for
99             the LoadBalancer.
100 
101         :type alias_dns_name: str
102         :param alias_hosted_zone_id: *Alias resource record sets only*
103             Information about the domain to which you are redirecting traffic.
104 
105         :type identifier: str
106         :param identifier: *Weighted and latency-based resource record sets
107             only* An identifier that differentiates among multiple resource
108             record sets that have the same combination of DNS name and type.
109 
110         :type weight: int
111         :param weight: *Weighted resource record sets only* Among resource
112             record sets that have the same combination of DNS name and type,
113             a value that determines what portion of traffic for the current
114             resource record set is routed to the associated location
115 
116         :type region: str
117         :param region: *Latency-based resource record sets only* Among resource
118             record sets that have the same combination of DNS name and type,
119             a value that determines which region this should be associated with
120             for the latency-based routing
121         """
122         change = Record(name, type, ttl,
123                 alias_hosted_zone_id=alias_hosted_zone_id,
124                 alias_dns_name=alias_dns_name, identifier=identifier,
125                 weight=weight, region=region)
126         self.changes.append([action, change])
127         return change
128 
129     def add_change_record(self, action, change):
130         """Add an existing record to a change set with the specified action"""
131         self.changes.append([action, change])
132         return
133 
134     def to_xml(self):
135         """Convert this ResourceRecordSet into XML
136         to be saved via the ChangeResourceRecordSetsRequest"""
137         changesXML = ""
138         for change in self.changes:
139             changeParams = {"action": change[0], "record": change[1].to_xml()}
140             changesXML += self.ChangeXML % changeParams
141         params = {"comment": self.comment, "changes": changesXML}
142         return self.ChangeResourceRecordSetsBody % params
143 
144     def commit(self):
145         """Commit this change"""
146         if not self.connection:
147             import boto
148             self.connection = boto.connect_route53()
149         return self.connection.change_rrsets(self.hosted_zone_id, self.to_xml())
150 
151     def endElement(self, name, value, connection):
152         """Overwritten to also add the NextRecordName and
153         NextRecordType to the base object"""
154         if name == 'NextRecordName':
155             self.next_record_name = value
156         elif name == 'NextRecordType':
157             self.next_record_type = value
158         else:
159             return ResultSet.endElement(self, name, value, connection)
160 
161     def __iter__(self):
162         """Override the next function to support paging"""
163         results = ResultSet.__iter__(self)
164         while results:
165             for obj in results:
166                 yield obj
167             if self.is_truncated:
168                 self.is_truncated = False
169                 results = self.connection.get_all_rrsets(self.hosted_zone_id, name=self.next_record_name, type=self.next_record_type)
170             else:
171                 results = None
172 
173 
174 
175 class Record(object):
176     """An individual ResourceRecordSet"""
177 
178     XMLBody = """<ResourceRecordSet>
179         <Name>%(name)s</Name>
180         <Type>%(type)s</Type>
181         %(weight)s
182         %(body)s
183     </ResourceRecordSet>"""
184 
185     WRRBody = """
186         <SetIdentifier>%(identifier)s</SetIdentifier>
187         <Weight>%(weight)s</Weight>
188     """
189 
190     RRRBody = """
191         <SetIdentifier>%(identifier)s</SetIdentifier>
192         <Region>%(region)s</Region>
193     """
194 
195     ResourceRecordsBody = """
196         <TTL>%(ttl)s</TTL>
197         <ResourceRecords>
198             %(records)s
199         </ResourceRecords>"""
200 
201     ResourceRecordBody = """<ResourceRecord>
202         <Value>%s</Value>
203     </ResourceRecord>"""
204 
205     AliasBody = """<AliasTarget>
206         <HostedZoneId>%s</HostedZoneId>
207         <DNSName>%s</DNSName>
208     </AliasTarget>"""
209 
210 
211 
212     def __init__(self, name=None, type=None, ttl=600, resource_records=None,
213             alias_hosted_zone_id=None, alias_dns_name=None, identifier=None,
214             weight=None, region=None):
215         self.name = name
216         self.type = type
217         self.ttl = ttl
218         if resource_records == None:
219             resource_records = []
220         self.resource_records = resource_records
221         self.alias_hosted_zone_id = alias_hosted_zone_id
222         self.alias_dns_name = alias_dns_name
223         self.identifier = identifier
224         self.weight = weight
225         self.region = region
226 
227     def __repr__(self):
228         return '<Record:%s:%s:%s>' % (self.name, self.type, self.to_print())
229 
230     def add_value(self, value):
231         """Add a resource record value"""
232         self.resource_records.append(value)
233 
234     def set_alias(self, alias_hosted_zone_id, alias_dns_name):
235         """Make this an alias resource record set"""
236         self.alias_hosted_zone_id = alias_hosted_zone_id
237         self.alias_dns_name = alias_dns_name
238 
239     def to_xml(self):
240         """Spit this resource record set out as XML"""
241         if self.alias_hosted_zone_id != None and self.alias_dns_name != None:
242             # Use alias
243             body = self.AliasBody % (self.alias_hosted_zone_id, self.alias_dns_name)
244         else:
245             # Use resource record(s)
246             records = ""
247 
248             for r in self.resource_records:
249                 records += self.ResourceRecordBody % r
250 
251             body = self.ResourceRecordsBody % {
252                 "ttl": self.ttl,
253                 "records": records,
254             }
255 
256         weight = ""
257 
258         if self.identifier != None and self.weight != None:
259             weight = self.WRRBody % {"identifier": self.identifier, "weight":
260                     self.weight}
261         elif self.identifier != None and self.region != None:
262             weight = self.RRRBody % {"identifier": self.identifier, "region":
263                     self.region}
264 
265         params = {
266             "name": self.name,
267             "type": self.type,
268             "weight": weight,
269             "body": body,
270         }
271         return self.XMLBody % params
272 
273     def to_print(self):
274         rr = ""
275         if self.alias_hosted_zone_id != None and self.alias_dns_name != None:
276             # Show alias
277             rr = 'ALIAS ' + self.alias_hosted_zone_id + ' ' + self.alias_dns_name
278         else:
279             # Show resource record(s)
280             rr =  ",".join(self.resource_records)
281 
282         if self.identifier != None and self.weight != None:
283             rr += ' (WRR id=%s, w=%s)' % (self.identifier, self.weight)
284         elif self.identifier != None and self.region != None:
285             rr += ' (LBR id=%s, region=%s)' % (self.identifier, self.region)
286 
287         return rr
288 
289     def endElement(self, name, value, connection):
290         if name == 'Name':
291             self.name = value
292         elif name == 'Type':
293             self.type = value
294         elif name == 'TTL':
295             self.ttl = value
296         elif name == 'Value':
297             self.resource_records.append(value)
298         elif name == 'HostedZoneId':
299             self.alias_hosted_zone_id = value
300         elif name == 'DNSName':
301             self.alias_dns_name = value
302         elif name == 'SetIdentifier':
303             self.identifier = value
304         elif name == 'Weight':
305             self.weight = value
306         elif name == 'Region':
307             self.region = value
308 
309     def startElement(self, name, attrs, connection):
310         return None
311
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/boto/route53/record.py b/boto/route53/record.py
--- a/boto/route53/record.py
+++ b/boto/route53/record.py
@@ -161,6 +161,7 @@
     def __iter__(self):
         """Override the next function to support paging"""
         results = ResultSet.__iter__(self)
+        truncated = self.is_truncated
         while results:
             for obj in results:
                 yield obj
@@ -169,6 +170,8 @@
                 results = self.connection.get_all_rrsets(self.hosted_zone_id, name=self.next_record_name, type=self.next_record_type)
             else:
                 results = None
+                self.is_truncated = truncated
+

{"golden_diff": "diff --git a/boto/route53/record.py b/boto/route53/record.py\n--- a/boto/route53/record.py\n+++ b/boto/route53/record.py\n@@ -161,6 +161,7 @@\n     def __iter__(self):\n         \"\"\"Override the next function to support paging\"\"\"\n         results = ResultSet.__iter__(self)\n+        truncated = self.is_truncated\n         while results:\n             for obj in results:\n                 yield obj\n@@ -169,6 +170,8 @@\n                 results = self.connection.get_all_rrsets(self.hosted_zone_id, name=self.next_record_name, type=self.next_record_type)\n             else:\n                 results = None\n+                self.is_truncated = truncated\n+\n", "issue": "Route53: ResourceRecordSet changes length when iterated through multiple times\nWhen iterating through a ResourceRecordSet the first iteration produced the correct number but subsequent iterations show the size of the ResourceRecordSet as 100\n\nThis gist shows a basic example:\nhttps://gist.github.com/jameslegg/6141226\n\n", "before_files": [{"content": "# Copyright (c) 2010 Chris Moyer http://coredumped.org/\n# Copyright (c) 2012 Mitch Garnaat http://garnaat.org/\n# Copyright (c) 2012 Amazon.com, Inc. or its affiliates.\n# All rights reserved.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a\n# copy of this software and associated documentation files (the\n# \"Software\"), to deal in the Software without restriction, including\n# without limitation the rights to use, copy, modify, merge, publish, dis-\n# tribute, sublicense, and/or sell copies of the Software, and to permit\n# persons to whom the Software is furnished to do so, subject to the fol-\n# lowing conditions:\n#\n# The above copyright notice and this permission notice shall be included\n# in all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-\n# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT\n# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n# IN THE SOFTWARE.\n\nRECORD_TYPES = ['A', 'AAAA', 'TXT', 'CNAME', 'MX', 'PTR', 'SRV', 'SPF']\n\nfrom boto.resultset import ResultSet\nclass ResourceRecordSets(ResultSet):\n    \"\"\"\n    A list of resource records.\n\n    :ivar hosted_zone_id: The ID of the hosted zone.\n    :ivar comment: A comment that will be stored with the change.\n    :ivar changes: A list of changes.\n    \"\"\"\n\n    ChangeResourceRecordSetsBody = \"\"\"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n    <ChangeResourceRecordSetsRequest xmlns=\"https://route53.amazonaws.com/doc/2012-02-29/\">\n            <ChangeBatch>\n                <Comment>%(comment)s</Comment>\n                <Changes>%(changes)s</Changes>\n            </ChangeBatch>\n        </ChangeResourceRecordSetsRequest>\"\"\"\n\n    ChangeXML = \"\"\"<Change>\n        <Action>%(action)s</Action>\n        %(record)s\n    </Change>\"\"\"\n\n    def __init__(self, connection=None, hosted_zone_id=None, comment=None):\n        self.connection = connection\n        self.hosted_zone_id = hosted_zone_id\n        self.comment = comment\n        self.changes = []\n        self.next_record_name = None\n        self.next_record_type = None\n        ResultSet.__init__(self, [('ResourceRecordSet', Record)])\n\n    def __repr__(self):\n        if self.changes:\n            record_list = ','.join([c.__repr__() for c in self.changes])\n        else:\n            record_list = ','.join([record.__repr__() for record in self])\n        return '<ResourceRecordSets:%s [%s]' % (self.hosted_zone_id,\n                                                record_list)\n\n    def add_change(self, action, name, type, ttl=600,\n            alias_hosted_zone_id=None, alias_dns_name=None, identifier=None,\n            weight=None, region=None):\n        \"\"\"\n        Add a change request to the set.\n\n        :type action: str\n        :param action: The action to perform ('CREATE'|'DELETE')\n\n        :type name: str\n        :param name: The name of the domain you want to perform the action on.\n\n        :type type: str\n        :param type: The DNS record type.  Valid values are:\n\n            * A\n            * AAAA\n            * CNAME\n            * MX\n            * NS\n            * PTR\n            * SOA\n            * SPF\n            * SRV\n            * TXT\n\n        :type ttl: int\n        :param ttl: The resource record cache time to live (TTL), in seconds.\n\n        :type alias_hosted_zone_id: str\n        :param alias_dns_name: *Alias resource record sets only* The value\n            of the hosted zone ID, CanonicalHostedZoneNameId, for\n            the LoadBalancer.\n\n        :type alias_dns_name: str\n        :param alias_hosted_zone_id: *Alias resource record sets only*\n            Information about the domain to which you are redirecting traffic.\n\n        :type identifier: str\n        :param identifier: *Weighted and latency-based resource record sets\n            only* An identifier that differentiates among multiple resource\n            record sets that have the same combination of DNS name and type.\n\n        :type weight: int\n        :param weight: *Weighted resource record sets only* Among resource\n            record sets that have the same combination of DNS name and type,\n            a value that determines what portion of traffic for the current\n            resource record set is routed to the associated location\n\n        :type region: str\n        :param region: *Latency-based resource record sets only* Among resource\n            record sets that have the same combination of DNS name and type,\n            a value that determines which region this should be associated with\n            for the latency-based routing\n        \"\"\"\n        change = Record(name, type, ttl,\n                alias_hosted_zone_id=alias_hosted_zone_id,\n                alias_dns_name=alias_dns_name, identifier=identifier,\n                weight=weight, region=region)\n        self.changes.append([action, change])\n        return change\n\n    def add_change_record(self, action, change):\n        \"\"\"Add an existing record to a change set with the specified action\"\"\"\n        self.changes.append([action, change])\n        return\n\n    def to_xml(self):\n        \"\"\"Convert this ResourceRecordSet into XML\n        to be saved via the ChangeResourceRecordSetsRequest\"\"\"\n        changesXML = \"\"\n        for change in self.changes:\n            changeParams = {\"action\": change[0], \"record\": change[1].to_xml()}\n            changesXML += self.ChangeXML % changeParams\n        params = {\"comment\": self.comment, \"changes\": changesXML}\n        return self.ChangeResourceRecordSetsBody % params\n\n    def commit(self):\n        \"\"\"Commit this change\"\"\"\n        if not self.connection:\n            import boto\n            self.connection = boto.connect_route53()\n        return self.connection.change_rrsets(self.hosted_zone_id, self.to_xml())\n\n    def endElement(self, name, value, connection):\n        \"\"\"Overwritten to also add the NextRecordName and\n        NextRecordType to the base object\"\"\"\n        if name == 'NextRecordName':\n            self.next_record_name = value\n        elif name == 'NextRecordType':\n            self.next_record_type = value\n        else:\n            return ResultSet.endElement(self, name, value, connection)\n\n    def __iter__(self):\n        \"\"\"Override the next function to support paging\"\"\"\n        results = ResultSet.__iter__(self)\n        while results:\n            for obj in results:\n                yield obj\n            if self.is_truncated:\n                self.is_truncated = False\n                results = self.connection.get_all_rrsets(self.hosted_zone_id, name=self.next_record_name, type=self.next_record_type)\n            else:\n                results = None\n\n\n\nclass Record(object):\n    \"\"\"An individual ResourceRecordSet\"\"\"\n\n    XMLBody = \"\"\"<ResourceRecordSet>\n        <Name>%(name)s</Name>\n        <Type>%(type)s</Type>\n        %(weight)s\n        %(body)s\n    </ResourceRecordSet>\"\"\"\n\n    WRRBody = \"\"\"\n        <SetIdentifier>%(identifier)s</SetIdentifier>\n        <Weight>%(weight)s</Weight>\n    \"\"\"\n\n    RRRBody = \"\"\"\n        <SetIdentifier>%(identifier)s</SetIdentifier>\n        <Region>%(region)s</Region>\n    \"\"\"\n\n    ResourceRecordsBody = \"\"\"\n        <TTL>%(ttl)s</TTL>\n        <ResourceRecords>\n            %(records)s\n        </ResourceRecords>\"\"\"\n\n    ResourceRecordBody = \"\"\"<ResourceRecord>\n        <Value>%s</Value>\n    </ResourceRecord>\"\"\"\n\n    AliasBody = \"\"\"<AliasTarget>\n        <HostedZoneId>%s</HostedZoneId>\n        <DNSName>%s</DNSName>\n    </AliasTarget>\"\"\"\n\n\n\n    def __init__(self, name=None, type=None, ttl=600, resource_records=None,\n            alias_hosted_zone_id=None, alias_dns_name=None, identifier=None,\n            weight=None, region=None):\n        self.name = name\n        self.type = type\n        self.ttl = ttl\n        if resource_records == None:\n            resource_records = []\n        self.resource_records = resource_records\n        self.alias_hosted_zone_id = alias_hosted_zone_id\n        self.alias_dns_name = alias_dns_name\n        self.identifier = identifier\n        self.weight = weight\n        self.region = region\n\n    def __repr__(self):\n        return '<Record:%s:%s:%s>' % (self.name, self.type, self.to_print())\n\n    def add_value(self, value):\n        \"\"\"Add a resource record value\"\"\"\n        self.resource_records.append(value)\n\n    def set_alias(self, alias_hosted_zone_id, alias_dns_name):\n        \"\"\"Make this an alias resource record set\"\"\"\n        self.alias_hosted_zone_id = alias_hosted_zone_id\n        self.alias_dns_name = alias_dns_name\n\n    def to_xml(self):\n        \"\"\"Spit this resource record set out as XML\"\"\"\n        if self.alias_hosted_zone_id != None and self.alias_dns_name != None:\n            # Use alias\n            body = self.AliasBody % (self.alias_hosted_zone_id, self.alias_dns_name)\n        else:\n            # Use resource record(s)\n            records = \"\"\n\n            for r in self.resource_records:\n                records += self.ResourceRecordBody % r\n\n            body = self.ResourceRecordsBody % {\n                \"ttl\": self.ttl,\n                \"records\": records,\n            }\n\n        weight = \"\"\n\n        if self.identifier != None and self.weight != None:\n            weight = self.WRRBody % {\"identifier\": self.identifier, \"weight\":\n                    self.weight}\n        elif self.identifier != None and self.region != None:\n            weight = self.RRRBody % {\"identifier\": self.identifier, \"region\":\n                    self.region}\n\n        params = {\n            \"name\": self.name,\n            \"type\": self.type,\n            \"weight\": weight,\n            \"body\": body,\n        }\n        return self.XMLBody % params\n\n    def to_print(self):\n        rr = \"\"\n        if self.alias_hosted_zone_id != None and self.alias_dns_name != None:\n            # Show alias\n            rr = 'ALIAS ' + self.alias_hosted_zone_id + ' ' + self.alias_dns_name\n        else:\n            # Show resource record(s)\n            rr =  \",\".join(self.resource_records)\n\n        if self.identifier != None and self.weight != None:\n            rr += ' (WRR id=%s, w=%s)' % (self.identifier, self.weight)\n        elif self.identifier != None and self.region != None:\n            rr += ' (LBR id=%s, region=%s)' % (self.identifier, self.region)\n\n        return rr\n\n    def endElement(self, name, value, connection):\n        if name == 'Name':\n            self.name = value\n        elif name == 'Type':\n            self.type = value\n        elif name == 'TTL':\n            self.ttl = value\n        elif name == 'Value':\n            self.resource_records.append(value)\n        elif name == 'HostedZoneId':\n            self.alias_hosted_zone_id = value\n        elif name == 'DNSName':\n            self.alias_dns_name = value\n        elif name == 'SetIdentifier':\n            self.identifier = value\n        elif name == 'Weight':\n            self.weight = value\n        elif name == 'Region':\n            self.region = value\n\n    def startElement(self, name, attrs, connection):\n        return None\n", "path": "boto/route53/record.py"}], "after_files": [{"content": "# Copyright (c) 2010 Chris Moyer http://coredumped.org/\n# Copyright (c) 2012 Mitch Garnaat http://garnaat.org/\n# Copyright (c) 2012 Amazon.com, Inc. or its affiliates.\n# All rights reserved.\n#\n# Permission is hereby granted, free of charge, to any person obtaining a\n# copy of this software and associated documentation files (the\n# \"Software\"), to deal in the Software without restriction, including\n# without limitation the rights to use, copy, modify, merge, publish, dis-\n# tribute, sublicense, and/or sell copies of the Software, and to permit\n# persons to whom the Software is furnished to do so, subject to the fol-\n# lowing conditions:\n#\n# The above copyright notice and this permission notice shall be included\n# in all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-\n# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT\n# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\n# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\n# IN THE SOFTWARE.\n\nRECORD_TYPES = ['A', 'AAAA', 'TXT', 'CNAME', 'MX', 'PTR', 'SRV', 'SPF']\n\nfrom boto.resultset import ResultSet\nclass ResourceRecordSets(ResultSet):\n    \"\"\"\n    A list of resource records.\n\n    :ivar hosted_zone_id: The ID of the hosted zone.\n    :ivar comment: A comment that will be stored with the change.\n    :ivar changes: A list of changes.\n    \"\"\"\n\n    ChangeResourceRecordSetsBody = \"\"\"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n    <ChangeResourceRecordSetsRequest xmlns=\"https://route53.amazonaws.com/doc/2012-02-29/\">\n            <ChangeBatch>\n                <Comment>%(comment)s</Comment>\n                <Changes>%(changes)s</Changes>\n            </ChangeBatch>\n        </ChangeResourceRecordSetsRequest>\"\"\"\n\n    ChangeXML = \"\"\"<Change>\n        <Action>%(action)s</Action>\n        %(record)s\n    </Change>\"\"\"\n\n    def __init__(self, connection=None, hosted_zone_id=None, comment=None):\n        self.connection = connection\n        self.hosted_zone_id = hosted_zone_id\n        self.comment = comment\n        self.changes = []\n        self.next_record_name = None\n        self.next_record_type = None\n        ResultSet.__init__(self, [('ResourceRecordSet', Record)])\n\n    def __repr__(self):\n        if self.changes:\n            record_list = ','.join([c.__repr__() for c in self.changes])\n        else:\n            record_list = ','.join([record.__repr__() for record in self])\n        return '<ResourceRecordSets:%s [%s]' % (self.hosted_zone_id,\n                                                record_list)\n\n    def add_change(self, action, name, type, ttl=600,\n            alias_hosted_zone_id=None, alias_dns_name=None, identifier=None,\n            weight=None, region=None):\n        \"\"\"\n        Add a change request to the set.\n\n        :type action: str\n        :param action: The action to perform ('CREATE'|'DELETE')\n\n        :type name: str\n        :param name: The name of the domain you want to perform the action on.\n\n        :type type: str\n        :param type: The DNS record type.  Valid values are:\n\n            * A\n            * AAAA\n            * CNAME\n            * MX\n            * NS\n            * PTR\n            * SOA\n            * SPF\n            * SRV\n            * TXT\n\n        :type ttl: int\n        :param ttl: The resource record cache time to live (TTL), in seconds.\n\n        :type alias_hosted_zone_id: str\n        :param alias_dns_name: *Alias resource record sets only* The value\n            of the hosted zone ID, CanonicalHostedZoneNameId, for\n            the LoadBalancer.\n\n        :type alias_dns_name: str\n        :param alias_hosted_zone_id: *Alias resource record sets only*\n            Information about the domain to which you are redirecting traffic.\n\n        :type identifier: str\n        :param identifier: *Weighted and latency-based resource record sets\n            only* An identifier that differentiates among multiple resource\n            record sets that have the same combination of DNS name and type.\n\n        :type weight: int\n        :param weight: *Weighted resource record sets only* Among resource\n            record sets that have the same combination of DNS name and type,\n            a value that determines what portion of traffic for the current\n            resource record set is routed to the associated location\n\n        :type region: str\n        :param region: *Latency-based resource record sets only* Among resource\n            record sets that have the same combination of DNS name and type,\n            a value that determines which region this should be associated with\n            for the latency-based routing\n        \"\"\"\n        change = Record(name, type, ttl,\n                alias_hosted_zone_id=alias_hosted_zone_id,\n                alias_dns_name=alias_dns_name, identifier=identifier,\n                weight=weight, region=region)\n        self.changes.append([action, change])\n        return change\n\n    def add_change_record(self, action, change):\n        \"\"\"Add an existing record to a change set with the specified action\"\"\"\n        self.changes.append([action, change])\n        return\n\n    def to_xml(self):\n        \"\"\"Convert this ResourceRecordSet into XML\n        to be saved via the ChangeResourceRecordSetsRequest\"\"\"\n        changesXML = \"\"\n        for change in self.changes:\n            changeParams = {\"action\": change[0], \"record\": change[1].to_xml()}\n            changesXML += self.ChangeXML % changeParams\n        params = {\"comment\": self.comment, \"changes\": changesXML}\n        return self.ChangeResourceRecordSetsBody % params\n\n    def commit(self):\n        \"\"\"Commit this change\"\"\"\n        if not self.connection:\n            import boto\n            self.connection = boto.connect_route53()\n        return self.connection.change_rrsets(self.hosted_zone_id, self.to_xml())\n\n    def endElement(self, name, value, connection):\n        \"\"\"Overwritten to also add the NextRecordName and\n        NextRecordType to the base object\"\"\"\n        if name == 'NextRecordName':\n            self.next_record_name = value\n        elif name == 'NextRecordType':\n            self.next_record_type = value\n        else:\n            return ResultSet.endElement(self, name, value, connection)\n\n    def __iter__(self):\n        \"\"\"Override the next function to support paging\"\"\"\n        results = ResultSet.__iter__(self)\n        truncated = self.is_truncated\n        while results:\n            for obj in results:\n                yield obj\n            if self.is_truncated:\n                self.is_truncated = False\n                results = self.connection.get_all_rrsets(self.hosted_zone_id, name=self.next_record_name, type=self.next_record_type)\n            else:\n                results = None\n                self.is_truncated = truncated\n\n\n\n\nclass Record(object):\n    \"\"\"An individual ResourceRecordSet\"\"\"\n\n    XMLBody = \"\"\"<ResourceRecordSet>\n        <Name>%(name)s</Name>\n        <Type>%(type)s</Type>\n        %(weight)s\n        %(body)s\n    </ResourceRecordSet>\"\"\"\n\n    WRRBody = \"\"\"\n        <SetIdentifier>%(identifier)s</SetIdentifier>\n        <Weight>%(weight)s</Weight>\n    \"\"\"\n\n    RRRBody = \"\"\"\n        <SetIdentifier>%(identifier)s</SetIdentifier>\n        <Region>%(region)s</Region>\n    \"\"\"\n\n    ResourceRecordsBody = \"\"\"\n        <TTL>%(ttl)s</TTL>\n        <ResourceRecords>\n            %(records)s\n        </ResourceRecords>\"\"\"\n\n    ResourceRecordBody = \"\"\"<ResourceRecord>\n        <Value>%s</Value>\n    </ResourceRecord>\"\"\"\n\n    AliasBody = \"\"\"<AliasTarget>\n        <HostedZoneId>%s</HostedZoneId>\n        <DNSName>%s</DNSName>\n    </AliasTarget>\"\"\"\n\n\n\n    def __init__(self, name=None, type=None, ttl=600, resource_records=None,\n            alias_hosted_zone_id=None, alias_dns_name=None, identifier=None,\n            weight=None, region=None):\n        self.name = name\n        self.type = type\n        self.ttl = ttl\n        if resource_records == None:\n            resource_records = []\n        self.resource_records = resource_records\n        self.alias_hosted_zone_id = alias_hosted_zone_id\n        self.alias_dns_name = alias_dns_name\n        self.identifier = identifier\n        self.weight = weight\n        self.region = region\n\n    def __repr__(self):\n        return '<Record:%s:%s:%s>' % (self.name, self.type, self.to_print())\n\n    def add_value(self, value):\n        \"\"\"Add a resource record value\"\"\"\n        self.resource_records.append(value)\n\n    def set_alias(self, alias_hosted_zone_id, alias_dns_name):\n        \"\"\"Make this an alias resource record set\"\"\"\n        self.alias_hosted_zone_id = alias_hosted_zone_id\n        self.alias_dns_name = alias_dns_name\n\n    def to_xml(self):\n        \"\"\"Spit this resource record set out as XML\"\"\"\n        if self.alias_hosted_zone_id != None and self.alias_dns_name != None:\n            # Use alias\n            body = self.AliasBody % (self.alias_hosted_zone_id, self.alias_dns_name)\n        else:\n            # Use resource record(s)\n            records = \"\"\n\n            for r in self.resource_records:\n                records += self.ResourceRecordBody % r\n\n            body = self.ResourceRecordsBody % {\n                \"ttl\": self.ttl,\n                \"records\": records,\n            }\n\n        weight = \"\"\n\n        if self.identifier != None and self.weight != None:\n            weight = self.WRRBody % {\"identifier\": self.identifier, \"weight\":\n                    self.weight}\n        elif self.identifier != None and self.region != None:\n            weight = self.RRRBody % {\"identifier\": self.identifier, \"region\":\n                    self.region}\n\n        params = {\n            \"name\": self.name,\n            \"type\": self.type,\n            \"weight\": weight,\n            \"body\": body,\n        }\n        return self.XMLBody % params\n\n    def to_print(self):\n        rr = \"\"\n        if self.alias_hosted_zone_id != None and self.alias_dns_name != None:\n            # Show alias\n            rr = 'ALIAS ' + self.alias_hosted_zone_id + ' ' + self.alias_dns_name\n        else:\n            # Show resource record(s)\n            rr =  \",\".join(self.resource_records)\n\n        if self.identifier != None and self.weight != None:\n            rr += ' (WRR id=%s, w=%s)' % (self.identifier, self.weight)\n        elif self.identifier != None and self.region != None:\n            rr += ' (LBR id=%s, region=%s)' % (self.identifier, self.region)\n\n        return rr\n\n    def endElement(self, name, value, connection):\n        if name == 'Name':\n            self.name = value\n        elif name == 'Type':\n            self.type = value\n        elif name == 'TTL':\n            self.ttl = value\n        elif name == 'Value':\n            self.resource_records.append(value)\n        elif name == 'HostedZoneId':\n            self.alias_hosted_zone_id = value\n        elif name == 'DNSName':\n            self.alias_dns_name = value\n        elif name == 'SetIdentifier':\n            self.identifier = value\n        elif name == 'Weight':\n            self.weight = value\n        elif name == 'Region':\n            self.region = value\n\n    def startElement(self, name, attrs, connection):\n        return None\n", "path": "boto/route53/record.py"}]}