... | ... |
@@ -919,7 +919,9 @@ class S3(object): |
919 | 919 |
debug("Object %s copied to %s" % (src_uri, dst_uri)) |
920 | 920 |
if not response_copy["data"] or getRootTagName(response_copy["data"]) == "CopyObjectResult": |
921 | 921 |
self.object_delete(src_uri) |
922 |
- debug("Object %s deleted" % src_uri) |
|
922 |
+ debug("Object '%s' deleted", src_uri) |
|
923 |
+ else: |
|
924 |
+ debug("Object '%s' NOT deleted because of an unexepected response data content.", src_uri) |
|
923 | 925 |
return response_copy |
924 | 926 |
|
925 | 927 |
def object_info(self, uri): |
... | ... |
@@ -84,16 +84,17 @@ def getPrettyFromXml(xmlstr): |
84 | 84 |
|
85 | 85 |
__all__.append("getPrettyFromXml") |
86 | 86 |
|
87 |
+RE_XML_NAMESPACE = re.compile(b'^(<?[^>]+?>\s*|\s*)(<\w+) xmlns=[\'"](http://[^\'"]+)[\'"]', re.MULTILINE) |
|
87 | 88 |
|
88 | 89 |
def stripNameSpace(xml): |
89 | 90 |
""" |
90 | 91 |
removeNameSpace(xml) -- remove top-level AWS namespace |
91 | 92 |
Operate on raw byte(utf-8) xml string. (Not unicode) |
92 | 93 |
""" |
93 |
- r = re.compile(b'^(<?[^>]+?>\s*)(<\w+) xmlns=[\'"](http://[^\'"]+)[\'"](.*)', re.MULTILINE) |
|
94 |
- if r.match(xml): |
|
95 |
- xmlns = r.match(xml).groups()[2] |
|
96 |
- xml = r.sub("\\1\\2\\4", xml) |
|
94 |
+ xmlns_match = RE_XML_NAMESPACE.match(xml) |
|
95 |
+ if xmlns_match: |
|
96 |
+ xmlns = xmlns_match.group(3) |
|
97 |
+ xml = RE_XML_NAMESPACE.sub("\\1\\2", xml, 1) |
|
97 | 98 |
else: |
98 | 99 |
xmlns = None |
99 | 100 |
return xml, xmlns |
... | ... |
@@ -169,9 +170,11 @@ def appendXmlTextNode(tag_name, text, parent): |
169 | 169 |
return el |
170 | 170 |
__all__.append("appendXmlTextNode") |
171 | 171 |
|
172 |
+RE_S3_DATESTRING = re.compile('\.[0-9]*(?:[Z\\-\\+]*?)') |
|
173 |
+ |
|
172 | 174 |
def dateS3toPython(date): |
173 | 175 |
# Reset milliseconds to 000 |
174 |
- date = re.compile('\.[0-9]*(?:[Z\\-\\+]*?)').sub(".000", date) |
|
176 |
+ date = RE_S3_DATESTRING.sub(".000", date) |
|
175 | 177 |
return dateutil.parser.parse(date, fuzzy=True) |
176 | 178 |
__all__.append("dateS3toPython") |
177 | 179 |
|