Skip to content

Commit 49e7490

Browse files
committed
The dump tool will fallback to the old 'content-type' name when 'content_type' is not found, so it can be actually used to dump attachments from older CouchDB versions.
--HG-- extra : convert_revision : svn%3A7a298fb0-333a-0410-83e7-658617cd9cf3/trunk%4071
1 parent aa6a3bd commit 49e7490

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

couchdb/tools/dump.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,10 @@ def dump_db(dburl, username=None, password=None, boundary=None):
3434
inner = MIMEMultipart('mixed')
3535
inner.attach(part)
3636
for name, info in attachments.items():
37-
maintype, subtype = info['content_type'].split('/', 1)
37+
content_type = info.get('content_type')
38+
if content_type is None: # CouchDB < 0.8
39+
content_type = info.get('content-type')
40+
maintype, subtype = content_type.split('/', 1)
3841
subpart = MIMEBase(maintype, subtype)
3942
subpart['Content-ID'] = name
4043
subpart.set_payload(b64decode(info['data']))

0 commit comments

Comments
 (0)