commit/galaxy-central: carlfeberhard: Controllers: remove mutable defaults from function definitions
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/1b78fcc8be7d/ Changeset: 1b78fcc8be7d User: carlfeberhard Date: 2013-11-11 18:33:30 Summary: Controllers: remove mutable defaults from function definitions Affected #: 4 files diff -r 9f06a82dab38e962fec43ee07e56ecf580f1e1d3 -r 1b78fcc8be7ddfc8258b322a0329367ea5553769 lib/galaxy/webapps/galaxy/api/item_tags.py --- a/lib/galaxy/webapps/galaxy/api/item_tags.py +++ b/lib/galaxy/webapps/galaxy/api/item_tags.py @@ -29,9 +29,10 @@ return self._api_value( tag, trans ) @web.expose_api - def create( self, trans, tag_name, payload={}, **kwd ): + def create( self, trans, tag_name, payload=None, **kwd ): """ """ + payload = payload or {} value = payload.get("value", None) tag = self._apply_item_tag( trans, self.tagged_item_class, kwd[self.tagged_item_id], tag_name, value ) return self._api_value( tag, trans ) @@ -51,6 +52,7 @@ def _api_value( self, tag, trans, view='element' ): return tag.to_dict( view=view, value_mapper={ 'id': trans.security.encode_id } ) + class HistoryContentTagsController( BaseItemTagsController ): controller_name = "history_content_tags" tagged_item_class = "HistoryDatasetAssociation" diff -r 9f06a82dab38e962fec43ee07e56ecf580f1e1d3 -r 1b78fcc8be7ddfc8258b322a0329367ea5553769 lib/galaxy/webapps/galaxy/api/provenance.py --- a/lib/galaxy/webapps/galaxy/api/provenance.py +++ b/lib/galaxy/webapps/galaxy/api/provenance.py @@ -25,7 +25,8 @@ return value @web.expose_api - def create( self, trans, tag_name, payload={}, **kwd ): + def create( self, trans, tag_name, payload=None, **kwd ): + payload = payload or {} raise HTTPNotImplemented() @web.expose_api diff -r 9f06a82dab38e962fec43ee07e56ecf580f1e1d3 -r 1b78fcc8be7ddfc8258b322a0329367ea5553769 lib/galaxy/webapps/galaxy/controllers/biostar.py --- a/lib/galaxy/webapps/galaxy/controllers/biostar.py +++ b/lib/galaxy/webapps/galaxy/controllers/biostar.py @@ -60,11 +60,12 @@ """ @web.expose - def biostar_redirect( self, trans, payload={}, biostar_action=None ): + def biostar_redirect( self, trans, payload=None, biostar_action=None ): """ Generate a redirect to a Biostar site using external authentication to pass Galaxy user information and information about a specific tool. """ + payload = payload or {} # Ensure biostar integration is enabled if not trans.app.config.biostar_url: return error( "Biostar integration is not enabled" ) @@ -86,11 +87,12 @@ return trans.response.send_redirect( url_for( trans.app.config.biostar_url, data=data, digest=digest, name=trans.app.config.biostar_key_name, action=biostar_action ) ) @web.expose - def biostar_question_redirect( self, trans, payload={} ): + def biostar_question_redirect( self, trans, payload=None ): """ Generate a redirect to a Biostar site using external authentication to pass Galaxy user information and information about a specific tool. """ + payload = payload or {} return self.biostar_redirect( trans, payload=payload, biostar_action='new' ) @web.expose @@ -114,4 +116,4 @@ 'tool_id': tool.id, 'tags': 'galaxy ' + tag_for_tool( tool ) } # Pass on to regular question method - return self.biostar_question_redirect( trans, payload ) \ No newline at end of file + return self.biostar_question_redirect( trans, payload ) diff -r 9f06a82dab38e962fec43ee07e56ecf580f1e1d3 -r 1b78fcc8be7ddfc8258b322a0329367ea5553769 lib/galaxy/webapps/galaxy/controllers/history.py --- a/lib/galaxy/webapps/galaxy/controllers/history.py +++ b/lib/galaxy/webapps/galaxy/controllers/history.py @@ -1240,8 +1240,9 @@ cannot_change[ send_to_user ][ history ].append( hda ) return can_change, cannot_change, no_change_needed, unique_no_change_needed, send_to_err - def _share_histories( self, trans, user, send_to_err, histories={} ): + def _share_histories( self, trans, user, send_to_err, histories=None ): # histories looks like: { userA: [ historyX, historyY ], userB: [ historyY ] } + histories = histories or {} msg = "" sent_to_emails = [] for send_to_user in histories.keys(): 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.
participants (1)
-
commits-noreply@bitbucket.org