Mercurial > bitten > bitten-test
comparison bitten/slave.py @ 889:9ac91d38198c
Make sure slave reads attachments as binary files. Fixes #657.
author | osimons |
---|---|
date | Fri, 21 Jan 2011 08:13:15 +0000 |
parents | c837eaf8ff2e |
children | 60d0807334ec |
comparison
equal
deleted
inserted
replaced
887:2d7e515d48cb | 889:9ac91d38198c |
---|---|
510 url = str(build_url + '/attach/' + resource_type) | 510 url = str(build_url + '/attach/' + resource_type) |
511 path = recipe.ctxt.resolve(attachment.attr['filename']) | 511 path = recipe.ctxt.resolve(attachment.attr['filename']) |
512 filename = os.path.basename(path) | 512 filename = os.path.basename(path) |
513 log.debug('Attaching file %s to %s...', attachment.attr['filename'], | 513 log.debug('Attaching file %s to %s...', attachment.attr['filename'], |
514 resource_type) | 514 resource_type) |
515 f = open(path) | 515 f = open(path, 'rb') |
516 try: | 516 try: |
517 data, content_type = encode_multipart_formdata({ | 517 data, content_type = encode_multipart_formdata({ |
518 'file': (filename, f.read()), | 518 'file': (filename, f.read()), |
519 'description': attachment.attr['description'], | 519 'description': attachment.attr['description'], |
520 '__FORM_TOKEN': form_token}) | 520 '__FORM_TOKEN': form_token}) |