Commit 9054233e authored by Brian Moe's avatar Brian Moe
parent 5726aefc
recursive-include debian *
recursive-include ligo/gracedb/test *
ligo-gracedb (1.11-1) unstable; urgency=low
* Fixed bug where stdin is specified, it is not actually read.
* Added python-ligo-common to dependencies
-- Brian Moe <brian.moe@ligo.org> Tue, 22 Jan 2013 17:13:51 -0500
ligo-gracedb (1.10-1) unstable; urgency=low
* CLI replace feature had subtle openssl bug. Using REST client.
* Typo in help text.
......
......@@ -8,7 +8,7 @@ X-Python-Version: >=2.6
Package: python-ligo-gracedb
Architecture: all
Depends: ${misc:Depends}, ${python:Depends}, python-m2crypto, python-cjson
Depends: ${misc:Depends}, ${python:Depends}, python-m2crypto, python-cjson, python-ligo-common
XB-Python-Version: ${python:Versions}
Provides: ${python:Provides}
Description: Gravity Wave Candidate Event Database
......
......@@ -23,7 +23,7 @@ import json
DEFAULT_SERVICE_URL = "https://gracedb.ligo.org/gracedb/cli"
GIT_TAG = 'gracedb-1.10-1'
GIT_TAG = 'gracedb-1.11-1'
#-----------------------------------------------------------------
# Util routines
......@@ -151,10 +151,12 @@ def encode_multipart_formdata(fields, files):
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"' % key)
L.append('')
L.append(value)
# str(value) in case it is unicode
L.append(str(value))
for (key, filename, value) in files:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, filename))
# str(filename) in case it is unicode
L.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, str(filename)))
L.append('Content-Type: %s' % get_content_type(filename))
L.append('')
L.append(value)
......@@ -398,8 +400,10 @@ class Client:
def upload(self, graceid, filename, filecontents=None, comment="", alert=False):
if filecontents is None:
if filename == '-':
filename = 'stdin'
filecontents = sys.stdin.read()
filecontents = open(filename, 'r').read()
else:
filecontents = open(filename, 'r').read()
fields = [
('graceid', graceid),
('comment', comment),
......
......@@ -203,6 +203,16 @@ class TestGracedb(unittest.TestCase):
r = gracedb.writeFile(eventId, uploadFile)
self.assertEqual(r.status, 201) # CREATED
def test_unicode_param(self):
"""
Test workaround for Python bug
http://bugs.python.org/issue11898
Raises exception if workaround fails.
"""
uploadFile = os.path.join(testdatadir, "upload.data.gz")
r = gracedb.writeFile(eventId, uploadFile)
self.assertEqual(r.status, 201) # CREATED
def test_logger(self):
import logging
import ligo.gracedb.rest
......
......@@ -121,22 +121,22 @@ fi
recordTest "verify new GPS time $GRACEID" "$RETCODE" "$(cat $OUTFILE)"
rm $OUTFILE
# Upload a file
# Upload a file (a binary file)
#
OUTFILE=$(mktemp)
${GRACEDB} upload $GRACEID "$TEST_DATA_DIR/upload.data" > $OUTFILE 2>&1
${GRACEDB} upload $GRACEID "$TEST_DATA_DIR/upload.data.gz" > $OUTFILE 2>&1
recordTest "upload file $GRACEID" "$?" "$(cat $OUTFILE)"
rm $OUTFILE
# Download that uploaded file
#
DOWNLOAD=$(mktemp)
${GRACEDB} download $GRACEID "upload.data" - > $DOWNLOAD 2>&1
${GRACEDB} download $GRACEID "upload.data.gz" - > $DOWNLOAD 2>&1
recordTest "download file" "$?" "$(cat $DOWNLOAD)"
# Verify that the uploaded file and downloaded file were the same
#
cmp --silent "$DOWNLOAD" "$TEST_DATA_DIR/upload.data"
cmp --silent "$DOWNLOAD" "$TEST_DATA_DIR/upload.data.gz"
recordTest "verify uploaded file" "$?" "$(cat $DOWNLOAD)"
rm $DOWNLOAD
......
......@@ -3,7 +3,7 @@ import os
from distutils.core import setup
version = "1.10"
version = "1.11"
setup(
name = "ligo-gracedb",
......@@ -17,7 +17,7 @@ setup(
license = 'GPL',
provides = ['ligo.gracedb'],
packages = [ 'ligo.gracedb', 'ligo.gracedb.test'],
package_data = { 'ligo.gracedb.test' : ['data/*', 'test.sh'] },
package_data = { 'ligo.gracedb.test' : ['data/*', 'test.sh', 'README'] },
requires = ['ligo', 'M2Crypto'],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment