[ARVADOS] updated: 890477eb5544437c339a7461fbf8e8f04020581b

git at public.curoverse.com git at public.curoverse.com
Fri Mar 7 16:51:19 EST 2014


Summary of changes:
 sdk/python/arvados/collection.py |    7 +++++--
 sdk/python/arvados/errors.py     |    2 ++
 sdk/python/test_collections.py   |    2 +-
 3 files changed, 8 insertions(+), 3 deletions(-)

       via  890477eb5544437c339a7461fbf8e8f04020581b (commit)
      from  27f9168d85ec178f440f683c19a4fec7ddc2ceda (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 890477eb5544437c339a7461fbf8e8f04020581b
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Mar 7 16:49:47 2014 -0500

    Fix CollectionReader treating any collection with additional +hints as
    an empty manifest.
    
    Now, accept hash+size+anyhints as a UUID, and if the argument looks
    like neither a UUID nor a manifest, raise an exception instead of
    proceeding with undefined results.

diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py
index b48b6df..ff29919 100644
--- a/sdk/python/arvados/collection.py
+++ b/sdk/python/arvados/collection.py
@@ -84,12 +84,15 @@ def normalize(collection):
 
 class CollectionReader(object):
     def __init__(self, manifest_locator_or_text):
-        if re.search(r'^[a-f0-9]{32}\+\d+(\+\S)*$', manifest_locator_or_text):
+        if re.search(r'^[a-f0-9]{32}(\+\d+)?(\+\S+)*$', manifest_locator_or_text):
             self._manifest_locator = manifest_locator_or_text
             self._manifest_text = None
-        else:
+        elif re.search(r'^\S+( [a-f0-9]{32,}(\+\S+)*)*( \d+:\d+:\S+)+\n', manifest_locator_or_text):
             self._manifest_text = manifest_locator_or_text
             self._manifest_locator = None
+        else:
+            raise errors.ArgumentError(
+                "Argument to CollectionReader must be a manifest or a collection UUID")
         self._streams = None
 
     def __enter__(self):
diff --git a/sdk/python/arvados/errors.py b/sdk/python/arvados/errors.py
index 5ea54be..e4c69a3 100644
--- a/sdk/python/arvados/errors.py
+++ b/sdk/python/arvados/errors.py
@@ -1,5 +1,7 @@
 # errors.py - Arvados-specific exceptions.
 
+class ArgumentError(Exception):
+    pass
 class SyntaxError(Exception):
     pass
 class AssertionError(Exception):
diff --git a/sdk/python/test_collections.py b/sdk/python/test_collections.py
index 3dfc72f..7df620d 100644
--- a/sdk/python/test_collections.py
+++ b/sdk/python/test_collections.py
@@ -42,7 +42,7 @@ class LocalCollectionReaderTest(unittest.TestCase):
         os.environ['KEEP_LOCAL_STORE'] = '/tmp'
         LocalCollectionWriterTest().runTest()
     def runTest(self):
-        cr = arvados.CollectionReader('d6c3b8e571f1b81ebb150a45ed06c884+114')
+        cr = arvados.CollectionReader('d6c3b8e571f1b81ebb150a45ed06c884+114+Xzizzle')
         got = []
         for s in cr.all_streams():
             for f in s.all_files():

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list