[ARVADOS] updated: 7b0d3939e19b6c62effdb5c808b811b38f4ffd57

git at public.curoverse.com git at public.curoverse.com
Mon Feb 23 15:15:07 EST 2015


Summary of changes:
 sdk/python/arvados/collection.py        | 2 +-
 sdk/python/arvados/commands/arv_copy.py | 2 +-
 sdk/python/arvados/keep.py              | 2 +-
 sdk/python/tests/test_keep_client.py    | 4 ++++
 4 files changed, 7 insertions(+), 3 deletions(-)

       via  7b0d3939e19b6c62effdb5c808b811b38f4ffd57 (commit)
      from  a47dc2bc994e89347fd94d088fa3756236c7fd52 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 7b0d3939e19b6c62effdb5c808b811b38f4ffd57
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Mon Feb 23 15:17:19 2015 -0500

    4520: manifest_text() is utf-8 encoded by default so it can be safely put() to
    Keep.  Add test that calling put() with a unicode string raises an error.
    Fetching user uuid in arv-copy uses num_retries.

diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py
index 7bfdf78..42ee16f 100644
--- a/sdk/python/arvados/collection.py
+++ b/sdk/python/arvados/collection.py
@@ -585,7 +585,7 @@ class CollectionWriter(CollectionBase):
             manifest += ' ' + ' '.join("%d:%d:%s" % (sfile[0], sfile[1], sfile[2].replace(' ', '\\040')) for sfile in stream[2])
             manifest += "\n"
 
-        return manifest
+        return manifest.encode("utf-8")
 
     def data_locators(self):
         ret = []
diff --git a/sdk/python/arvados/commands/arv_copy.py b/sdk/python/arvados/commands/arv_copy.py
index 9908fd0..308bd78 100755
--- a/sdk/python/arvados/commands/arv_copy.py
+++ b/sdk/python/arvados/commands/arv_copy.py
@@ -100,7 +100,7 @@ def main():
     dst_arv = api_for_instance(args.destination_arvados)
 
     if not args.project_uuid:
-        args.project_uuid = dst_arv.users().current().execute()["uuid"]
+        args.project_uuid = dst_arv.users().current().execute(num_retries=args.retries)["uuid"]
 
     # Identify the kind of object we have been given, and begin copying.
     t = uuid_type(src_arv, args.object_uuid)
diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py
index 1b72687..c443f60 100644
--- a/sdk/python/arvados/keep.py
+++ b/sdk/python/arvados/keep.py
@@ -685,7 +685,7 @@ class KeepClient(object):
           KeepClient is initialized.
         """
 
-        if type(data) is not str:
+        if not isinstance(data, str):
             raise arvados.errors.ArgumentError("Argument 'data' to KeepClient.put must be type 'str'")
 
         data_hash = hashlib.md5(data).hexdigest()
diff --git a/sdk/python/tests/test_keep_client.py b/sdk/python/tests/test_keep_client.py
index 6d4d3cd..7e6bb0c 100644
--- a/sdk/python/tests/test_keep_client.py
+++ b/sdk/python/tests/test_keep_client.py
@@ -76,6 +76,10 @@ class KeepTestCase(run_test_server.TestCaseWithServers):
             '^d41d8cd98f00b204e9800998ecf8427e\+0',
             ('wrong locator from Keep.put(""): ' + blob_locator))
 
+    def test_data_must_be_str(self):
+        with self.assertRaises(arvados.errors.ArgumentError):
+            # Illegal to put() a unicode string.
+            foo_locator = self.keep_client.put(u'foo')
 
 class KeepPermissionTestCase(run_test_server.TestCaseWithServers):
     MAIN_SERVER = {}

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list