Hello, Peter

The blank panel should definitely be handled more gracefully in this situation - I'll work on that.

Have you noticed though, since your patch, any particular pattern to which metadata names are turning out to equal None (some obviously missing metadata field)? Is there a particular datatype?
 
Have you seen the assertion fail?
C



On Wed, Jan 16, 2013 at 11:31 AM, Peter Cock <p.j.a.cock@googlemail.com> wrote:
Hello all,

I've noticed on my test setup (tracking galaxy-central) a problem with
some histories not displaying. If I click on saved histories, I am show
a list. Some will load (slower than I recall), but others result in a blank
right hand pane - with the following error from run.sh

galaxy.webapps.galaxy.api.history_contents ERROR 2013-01-16
15:24:22,726 Error in history API at listing contents: <type
'exceptions.TypeError'>, cannot concatenate 'str' and 'NoneType'
objects

The same error and blank pane happens if I click on the reload
history icon. A screenshot is attached.

This error is coming from HistoryContentsController in file
lib/galaxy/webapps/galaxy/api/history_contents.py - specifically
in the call to get_hda_dict. I tried modifying this for loop so that
any individual transaction with an error is ignored (but a debug
message logged), and I could then load the rest of the problem
histories.

The error from get_hda_dict is from the first line, which takes
the galaxy.model.HistoryDatasetAssociation object and asks:

hda_dict = hda.get_api_value( view='element' )

That takes us to lib/galaxy/model/__init__.py and the root of
the problem: I am seeing entries where both name and val
are None, meaning this line fails with the TypeError above:

rval['metadata_' + name] = val

Clearly some of my histories now have some 'bad' data in them,
and currently Galaxy is failing to cope. Based on the ID numbers
this has been happening for a while, so not a recent regression.

Here is a patch which seems to help.

Peter

$ hg diff lib/galaxy/model/__init__.py
diff -r 81c3b8a6a621 lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py      Wed Jan 16 15:14:04 2013 +0000
+++ b/lib/galaxy/model/__init__.py      Wed Jan 16 16:26:28 2013 +0000
@@ -1530,7 +1530,11 @@
                 val = val.file_name
             elif isinstance( val, list ):
                 val = ', '.join( [str(v) for v in val] )
-            rval['metadata_' + name] = val
+            if name is None:
+                log.debug("get_api_value(view=%r) : name %r, val %r"
% (view, name, val))
+                assert val is None, "get_api_value(view=%r) : name
%r, val %r" % (view, name, val)
+            else:
+                rval['metadata_' + name] = val
         return rval

 class HistoryDatasetAssociationDisplayAtAuthorization( object ):

___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:

  http://lists.bx.psu.edu/