[galaxy-commits] commit/galaxy-central: dan: Add use_name flag to ldda.templates_dict() that will return a dictionary using the form field names instead of labels.

Bitbucket commits-noreply at bitbucket.org
Wed Mar 28 12:01:54 EDT 2012


1 new commit in galaxy-central:


https://bitbucket.org/galaxy/galaxy-central/changeset/0c6cf4f53c4e/
changeset:   0c6cf4f53c4e
user:        dan
date:        2012-03-28 18:01:44
summary:     Add use_name flag to ldda.templates_dict() that will return a dictionary using the form field names instead of labels.
affected #:  1 file

diff -r 15bd01c59c24eae40026470459c5577cba063768 -r 0c6cf4f53c4efad46fe7716587ca5a2dddff049c lib/galaxy/model/__init__.py
--- a/lib/galaxy/model/__init__.py
+++ b/lib/galaxy/model/__init__.py
@@ -1536,17 +1536,22 @@
             else:
                 return template.get_widgets( trans.user )
         return []
-    def templates_dict( self ):
+    def templates_dict( self, use_name=False ):
         """
         Returns a dict of template info
         """
+        #TODO: Should have a method that allows names and labels to be returned together in a structured way
         template_data = {}
         for temp_info in self.info_association:
             template = temp_info.template
             content = temp_info.info.content
             tmp_dict = {}
             for field in template.fields:
-                tmp_dict[field['label']] = content[field['name']]
+                if use_name:
+                    name = field[ 'name' ]
+                else:
+                    name = field[ 'label' ]
+                tmp_dict[ name ] = content[ field[ 'name' ] ]
             template_data[template.name] = tmp_dict
         return template_data
     def templates_json( self ):

Repository URL: https://bitbucket.org/galaxy/galaxy-central/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.


More information about the galaxy-commits mailing list