# HG changeset patch -- Bitbucket.org
# Project galaxy-dist
# URL http://bitbucket.org/galaxy/galaxy-dist/overview
# User jeremy goecks <jeremy.goecks(a)emory.edu>
# Date 1277168327 14400
# Node ID 764ecc0cf3fdc4885de777f26e1ae7c06a85acbf
# Parent 7d3a9212b15e82327c2af7c3222995f358532d60
Refactor code that builds recent tools list to make it easier to understand and more efficient.
--- a/lib/galaxy/web/controllers/root.py
+++ b/lib/galaxy/web/controllers/root.py
@@ -38,8 +38,9 @@ class RootController( BaseController, Us
filter( self.app.model.Job.user==trans.user ). \
order_by( self.app.model.Job.create_time.desc() ):
tool_id = row[0]
- if tool_id in toolbox.tools_by_id:
- recent_tools.append( toolbox.tools_by_id[tool_id] )
+ a_tool = toolbox.tools_by_id.get( tool_id, None )
+ if a_tool and a_tool not in recent_tools:
+ recent_tools.append( a_tool )
## TODO: make number of recently used tools a user preference.
if len ( recent_tools ) == 5:
break